Class: Heatmap::Area

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, alpha = 1) ⇒ Area

Returns a new instance of Area.

Raises:

  • (ArgumentError)


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

def initialize(x, y, alpha = 1)
  raise(ArgumentError, "The x, y, alpha values need to be >= 0") if x < 0 || y < 0 || alpha < 0
  @x, @y, @alpha = x, y, alpha
end

Instance Attribute Details

#alphaObject (readonly)

Returns the value of attribute alpha.



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

def alpha
  @alpha
end

#xObject (readonly)

Returns the value of attribute x.



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

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



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

def y
  @y
end

Instance Method Details

#x_yObject



11
12
13
# File 'lib/heatmap/area.rb', line 11

def x_y
  "+#{x}+#{y}"
end