Class: Lizard::Color
- Inherits:
-
Object
- Object
- Lizard::Color
- Defined in:
- lib/lizard/color.rb
Instance Attribute Summary collapse
-
#frequency ⇒ Object
readonly
Returns the value of attribute frequency.
-
#hex ⇒ Object
readonly
Returns the value of attribute hex.
Instance Method Summary collapse
- #blue ⇒ Object
- #green ⇒ Object
-
#initialize(frequency, hex) ⇒ Color
constructor
A new instance of Color.
- #red ⇒ Object
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
#frequency ⇒ Object (readonly)
Returns the value of attribute frequency.
3 4 5 |
# File 'lib/lizard/color.rb', line 3 def frequency @frequency end |
#hex ⇒ Object (readonly)
Returns the value of attribute hex.
3 4 5 |
# File 'lib/lizard/color.rb', line 3 def hex @hex end |
Instance Method Details
#blue ⇒ Object
18 19 20 |
# File 'lib/lizard/color.rb', line 18 def blue @hex[4,2].to_i(16) end |
#green ⇒ Object
14 15 16 |
# File 'lib/lizard/color.rb', line 14 def green @hex[2,2].to_i(16) end |
#red ⇒ Object
10 11 12 |
# File 'lib/lizard/color.rb', line 10 def red @hex[0,2].to_i(16) end |