Class: Rainbow::Color::Indexed
- Inherits:
-
Rainbow::Color
- Object
- Rainbow::Color
- Rainbow::Color::Indexed
- Defined in:
- lib/rainbow/color.rb
Instance Attribute Summary collapse
-
#num ⇒ Object
readonly
Returns the value of attribute num.
Attributes inherited from Rainbow::Color
Instance Method Summary collapse
- #codes ⇒ Object
-
#initialize(ground, num) ⇒ Indexed
constructor
A new instance of Indexed.
Methods inherited from Rainbow::Color
Constructor Details
#initialize(ground, num) ⇒ Indexed
Returns a new instance of Indexed.
57 58 59 60 |
# File 'lib/rainbow/color.rb', line 57 def initialize(ground, num) @ground = ground @num = num end |
Instance Attribute Details
#num ⇒ Object (readonly)
Returns the value of attribute num.
55 56 57 |
# File 'lib/rainbow/color.rb', line 55 def num @num end |
Instance Method Details
#codes ⇒ Object
62 63 64 65 66 |
# File 'lib/rainbow/color.rb', line 62 def codes code = num + (ground == :foreground ? 30 : 40) [code] end |