Class: Colorlib::ColoredString
- Inherits:
-
Object
- Object
- Colorlib::ColoredString
- Defined in:
- lib/colorlib/colored_string.rb
Instance Attribute Summary collapse
-
#attrib ⇒ Object
readonly
Returns the value of attribute attrib.
Instance Method Summary collapse
- #color(color) ⇒ Object
-
#initialize(string) ⇒ ColoredString
constructor
A new instance of ColoredString.
Constructor Details
#initialize(string) ⇒ ColoredString
Returns a new instance of ColoredString.
8 9 10 11 |
# File 'lib/colorlib/colored_string.rb', line 8 def initialize(string) @string = string @attrib = ColorAttribute.new end |
Instance Attribute Details
#attrib ⇒ Object (readonly)
Returns the value of attribute attrib.
6 7 8 |
# File 'lib/colorlib/colored_string.rb', line 6 def attrib @attrib end |
Instance Method Details
#color(color) ⇒ Object
13 14 15 |
# File 'lib/colorlib/colored_string.rb', line 13 def color(color) @attrib.color = color end |