Class: LegendBox
- Inherits:
-
Object
- Object
- LegendBox
- Defined in:
- lib/legend_box.rb
Instance Method Summary collapse
- #draw(legend) ⇒ Object
-
#initialize(artist, top_left = {:x => 20, :y => 20}) ⇒ LegendBox
constructor
A new instance of LegendBox.
Constructor Details
#initialize(artist, top_left = {:x => 20, :y => 20}) ⇒ LegendBox
Returns a new instance of LegendBox.
2 3 4 5 6 |
# File 'lib/legend_box.rb', line 2 def initialize(artist, top_left = {:x => 20, :y => 20}) @x = top_left[:x] @y = top_left[:y] @artist = artist end |
Instance Method Details
#draw(legend) ⇒ Object
8 9 10 11 12 |
# File 'lib/legend_box.rb', line 8 def draw(legend) @artist.rect(@x,@y,10,10) @artist.text(legend.strip == '' ? '[Unknown]' : legend, @x + 50, @y) @y += 15 end |