class VarietyFormat::LTSVFormatter

Public Instance Methods

call(severity, time, progname, msg) click to toggle source
# File lib/variety_format/ltsv_formatter.rb, line 3
def call(severity, time, progname, msg)
  to_ltsv(msg) + "\n"
end

Private Instance Methods

to_ltsv(msg) click to toggle source
# File lib/variety_format/ltsv_formatter.rb, line 9
def to_ltsv(msg)
  return to_ltsv_from_hash(msg) if msg.kind_of?(Hash)
  return to_ltsv_from_array(msg) if msg.kind_of?(Array)
  msg
end
to_ltsv_from_array(array) click to toggle source
# File lib/variety_format/ltsv_formatter.rb, line 24
def to_ltsv_from_array(array)
  array.join("\t")
end
to_ltsv_from_hash(hash) click to toggle source
# File lib/variety_format/ltsv_formatter.rb, line 15
def to_ltsv_from_hash(hash)
  pairs = []
  hash.each { |k, v|
    pair = "#{k}:#{v}"
    pairs.push(pair)
  }
  pairs.join("\t")
end