module AppleSystemStatus

Constants

VERSION

Public Class Methods

format_response(hash, format) click to toggle source
# File lib/apple_system_status.rb, line 5
def self.format_response(hash, format)
  case format
  when "plain"
    str = "#{hash[:title]}\n"
    hash[:services].each do |service|
      str << "#{service[:title]},#{service[:status]},#{service[:description]}\n"
    end
    str

  when "json"
    hash.to_json

  else
    raise "Unknown format: #{format}"
  end
end