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.
39 40 41 42 |
# File 'lib/rainbow/color.rb', line 39 def initialize(ground, num) @ground = ground @num = num end |
Instance Attribute Details
#num ⇒ Object (readonly)
Returns the value of attribute num.
37 38 39 |
# File 'lib/rainbow/color.rb', line 37 def num @num end |
Instance Method Details
#codes ⇒ Object
44 45 46 47 48 |
# File 'lib/rainbow/color.rb', line 44 def codes code = num + (ground == :foreground ? 30 : 40) [code] end |