class Rainbow::Color

Attributes

color[R]
location[R]

Public Class Methods

new(color, location) click to toggle source

color - Fixnum location - Fixnum (0-100)

# File lib/rainbow/color.rb, line 7
def initialize(color, location)
  @color    = color
  @location = location

  assert_location!
end

Public Instance Methods

b() click to toggle source
# File lib/rainbow/color.rb, line 22
def b
  ChunkyPNG::Color.b(color)
end
g() click to toggle source
# File lib/rainbow/color.rb, line 18
def g
  ChunkyPNG::Color.g(color)
end
r() click to toggle source
# File lib/rainbow/color.rb, line 14
def r
  ChunkyPNG::Color.r(color)
end

Private Instance Methods

assert_location!() click to toggle source
# File lib/rainbow/color.rb, line 28
def assert_location!
  raise ArgumentError, 'location must be between 0 and 100' if location < 0 || location > 100
end