Class: Helium::Console::Formatter::LazyStringEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/helium/console/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ LazyStringEvaluator

Returns a new instance of LazyStringEvaluator.



13
14
15
# File 'lib/helium/console/formatter.rb', line 13

def initialize(&block)
  @lines = Enumerator.new { |y| block.(y) }
end

Instance Attribute Details

#linesObject (readonly)

Returns the value of attribute lines.



17
18
19
# File 'lib/helium/console/formatter.rb', line 17

def lines
  @lines
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/helium/console/formatter.rb', line 19

def to_s
  lines.to_a.join
end