Method: Command::Csv#output

Defined in:
lib/command/csv.rb

#output(stream = nil) ⇒ Object

CSV形式で出力するstream には出力先のIOオブジェクトを指定。nilだったら$stdoutに出力



51
52
53
54
55
# File 'lib/command/csv.rb', line 51

def output(stream = nil)
  stream ||= @options["filename"] ? File.open(@options["filename"], "w:UTF-8") : $stdout
  stream.puts(generate)
  stream.close if @options["filename"]
end