class MagicCloud::Word
Class representing individual word in word cloud
Attributes
options[R]
text[R]
Public Class Methods
new(text, options)
click to toggle source
Calls superclass method
MagicCloud::Shape::new
# File lib/magic_cloud/word.rb, line 7 def initialize(text, options) super() @text, @options = text.to_s, options end
Public Instance Methods
draw(canvas, opts = {})
click to toggle source
# File lib/magic_cloud/word.rb, line 18 def draw(canvas, opts = {}) canvas.draw_text(text, @options.merge(x: x, y: y).merge(opts)) end
inspect()
click to toggle source
# File lib/magic_cloud/word.rb, line 26 def inspect "#<#{self.class} #{text}:#{options}>" end
measure(canvas)
click to toggle source
# File lib/magic_cloud/word.rb, line 22 def measure(canvas) canvas.measure_text(text, @options) end
size()
click to toggle source
# File lib/magic_cloud/word.rb, line 14 def size options[:font_size] # FIXME end