class Sensu::Plugin::Metric::CLI::JSON

Public Instance Methods

output(obj=nil) click to toggle source
# File lib/sensu-plugin/metric/cli.rb, line 10
def output(obj=nil)
  if obj.is_a?(String) || obj.is_a?(Exception)
    puts obj.to_s
  elsif obj.is_a?(Hash)
    obj['timestamp'] ||= Time.now.to_i
    puts ::JSON.generate(obj)
  end
end