Class: Gradient::Point

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location, color, opacity) ⇒ Point

Returns a new instance of Point.



6
7
8
# File 'lib/gradient/point.rb', line 6

def initialize(location, color, opacity)
  @location, @color, @opacity = location, color, opacity
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



4
5
6
# File 'lib/gradient/point.rb', line 4

def color
  @color
end

#locationObject (readonly)

Returns the value of attribute location.



4
5
6
# File 'lib/gradient/point.rb', line 4

def location
  @location
end

#opacityObject (readonly)

Returns the value of attribute opacity.



4
5
6
# File 'lib/gradient/point.rb', line 4

def opacity
  @opacity
end

Instance Method Details

#inspectObject



10
11
12
# File 'lib/gradient/point.rb', line 10

def inspect
  "#<Point #{location * 100} ##{color.hex}#{"%02x" % (opacity * 255).round}>"
end