class LineLog::Formatters::KeyValue
Public Instance Methods
call(data)
click to toggle source
# File lib/line_log/formatters/key_value.rb, line 4 def call(data) data.keys .map { |key| format(key, data[key]) } .join(' ') end
Protected Instance Methods
format(key, value)
click to toggle source
# File lib/line_log/formatters/key_value.rb, line 12 def format(key, value) "#{key}=#{parse_value(key, value)}" end
parse_value(key, value)
click to toggle source
# File lib/line_log/formatters/key_value.rb, line 16 def parse_value(key, value) # Exactly preserve the previous output # Parsing this can be ambigious if the error messages contains # a single quote return "'#{value}'" if value.is_a? String return Kernel.format('%.2f', value) if value.is_a? Float value end