Class: Rainbow::Wrapper
- Inherits:
-
Object
- Object
- Rainbow::Wrapper
- Defined in:
- lib/rainbow/wrapper.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Returns the value of attribute enabled.
Instance Method Summary collapse
-
#initialize(enabled = true) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #wrap(string) ⇒ Object
Constructor Details
#initialize(enabled = true) ⇒ Wrapper
Returns a new instance of Wrapper.
10 11 12 |
# File 'lib/rainbow/wrapper.rb', line 10 def initialize(enabled = true) @enabled = enabled end |
Instance Attribute Details
#enabled ⇒ Object
Returns the value of attribute enabled.
8 9 10 |
# File 'lib/rainbow/wrapper.rb', line 8 def enabled @enabled end |
Instance Method Details
#wrap(string) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/rainbow/wrapper.rb', line 14 def wrap(string) if enabled Presenter.new(string.to_s) else NullPresenter.new(string.to_s) end end |