Class: Kernel::PoorsManStringBuilder
- Defined in:
- lib/guerrilla_patch/kernel.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #add(item) ⇒ Object (also: #always)
-
#initialize ⇒ PoorsManStringBuilder
constructor
A new instance of PoorsManStringBuilder.
- #when_present(item, &block) ⇒ Object
Constructor Details
#initialize ⇒ PoorsManStringBuilder
Returns a new instance of PoorsManStringBuilder.
25 26 27 |
# File 'lib/guerrilla_patch/kernel.rb', line 25 def initialize @result = '' end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
23 24 25 |
# File 'lib/guerrilla_patch/kernel.rb', line 23 def result @result end |
Instance Method Details
#add(item) ⇒ Object Also known as: always
29 30 31 |
# File 'lib/guerrilla_patch/kernel.rb', line 29 def add(item) @result << item.to_s end |
#when_present(item, &block) ⇒ Object
34 35 36 |
# File 'lib/guerrilla_patch/kernel.rb', line 34 def when_present(item, &block) @result << Kernel.when_present(item, &block).to_s end |