Class: Kernel::PoorsManStringBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/guerrilla_patch/kernel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePoorsManStringBuilder

Returns a new instance of PoorsManStringBuilder.



25
26
27
# File 'lib/guerrilla_patch/kernel.rb', line 25

def initialize
  @result = ''
end

Instance Attribute Details

#resultObject (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