Class: Lines::StreamOutputter
- Inherits:
-
Object
- Object
- Lines::StreamOutputter
- Defined in:
- lib/lines.rb
Instance Method Summary collapse
-
#initialize(stream = $stderr) ⇒ StreamOutputter
constructor
stream must accept a #write(str) message.
- #output(dumper, obj) ⇒ Object
Constructor Details
#initialize(stream = $stderr) ⇒ StreamOutputter
stream must accept a #write(str) message
130 131 132 133 134 |
# File 'lib/lines.rb', line 130 def initialize(stream = $stderr) @stream = stream # Is this needed ? @stream.sync = true if @stream.respond_to?(:sync) end |
Instance Method Details
#output(dumper, obj) ⇒ Object
136 137 138 139 |
# File 'lib/lines.rb', line 136 def output(dumper, obj) str = dumper.dump(obj) + NL stream.write str end |