Class: Heatmap::Map

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMap

Returns a new instance of Map.

Raises:

  • (RuntimeError)


6
7
8
9
10
# File 'lib/heatmap/map.rb', line 6

def initialize
  location = `which convert` || `where convert`
  raise(RuntimeError, "You need to have ImageMagick installed!") if location.nil? || location.strip.empty?
  @area = []
end

Instance Attribute Details

#areaObject

Returns the value of attribute area.



4
5
6
# File 'lib/heatmap/map.rb', line 4

def area
  @area
end

Instance Method Details

#<<(item) ⇒ Object



12
13
14
# File 'lib/heatmap/map.rb', line 12

def <<(item)
  @area << item
end

#output(file = 'heatmap.png') ⇒ Object



16
17
18
# File 'lib/heatmap/map.rb', line 16

def output(file = 'heatmap.png')
  Heatmap::Image.new(@area, file)
end