class LogLineParser::CommandLineInterface::Converter
Public Instance Methods
execute(options, output=STDOUT, input=ARGF)
click to toggle source
# File lib/log_line_parser/command_line_interface.rb, line 14 def execute(options, output=STDOUT, input=ARGF) output_format = options[:format] || DEFAULT_FORMAT case output_format when DEFAULT_FORMAT to_csv(input, output) when "tsv" to_tsv(input, output) when "ltsv" to_ltsv(input, output, options[:log_format]) else raise UnsupportedFormatError.new(output_format) end end
to_csv(input, output)
click to toggle source
# File lib/log_line_parser/command_line_interface.rb, line 28 def to_csv(input, output) input.each_line do |line| output.print Utils.to_csv(line.chomp) end end
to_ltsv(input, output, parser)
click to toggle source
# File lib/log_line_parser/command_line_interface.rb, line 40 def to_ltsv(input, output, parser) input.each_line do |line| output.puts parser.to_ltsv(line.chomp) end end
to_tsv(input, output)
click to toggle source
# File lib/log_line_parser/command_line_interface.rb, line 34 def to_tsv(input, output) input.each_line do |line| output.puts Utils.to_tsv(line.chomp) end end