Class: LegendBox

Inherits:
Object
  • Object
show all
Defined in:
lib/legend_box.rb

Instance Method Summary collapse

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