Class: Lizard::Color

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(frequency, hex) ⇒ Color

Returns a new instance of Color.



5
6
7
8
# File 'lib/lizard/color.rb', line 5

def initialize(frequency, hex)
  @frequency = frequency
  @hex = hex
end

Instance Attribute Details

#frequencyObject (readonly)

Returns the value of attribute frequency.



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

def frequency
  @frequency
end

#hexObject (readonly)

Returns the value of attribute hex.



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

def hex
  @hex
end

Instance Method Details

#blueObject



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

def blue
  @hex[4,2].to_i(16)
end

#greenObject



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

def green
  @hex[2,2].to_i(16)
end

#redObject



10
11
12
# File 'lib/lizard/color.rb', line 10

def red
  @hex[0,2].to_i(16)
end