Class: Rainbow::Color

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(color, location) ⇒ Color

color - Fixnum location - Fixnum (0-100)



7
8
9
10
11
12
# File 'lib/rainbow/color.rb', line 7

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

  assert_location!
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



3
4
5
# File 'lib/rainbow/color.rb', line 3

def color
  @color
end

#locationObject (readonly)

Returns the value of attribute location.



3
4
5
# File 'lib/rainbow/color.rb', line 3

def location
  @location
end

Instance Method Details

#bObject



22
23
24
# File 'lib/rainbow/color.rb', line 22

def b
  ChunkyPNG::Color.b(color)
end

#gObject



18
19
20
# File 'lib/rainbow/color.rb', line 18

def g
  ChunkyPNG::Color.g(color)
end

#rObject



14
15
16
# File 'lib/rainbow/color.rb', line 14

def r
  ChunkyPNG::Color.r(color)
end