module LogLineParser::Ltsv

Constants

FORMAT_STRING_LABEL_TABLE

Label names are borrowed from ltsv.org/

LABEL_SEPARATOR
TAB

Public Class Methods

format_strings_to_labels(format_strings) click to toggle source
# File lib/log_line_parser/ltsv.rb, line 36
def self.format_strings_to_labels(format_strings)
  format_strings.map do |string|
    FORMAT_STRING_LABEL_TABLE[string]||string
  end
end
to_ltsv(labels, values) click to toggle source
# File lib/log_line_parser/ltsv.rb, line 42
def self.to_ltsv(labels, values)
  fields = labels.zip(values).map {|field| field.join(LABEL_SEPARATOR) }
  fields.join(TAB)
end