Class: Lines::StreamOutputter

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

Instance Method Summary collapse

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