Module: AppleSystemStatus

Defined in:
lib/apple_system_status.rb,
lib/apple_system_status/cli.rb,
lib/apple_system_status/crawler.rb,
lib/apple_system_status/version.rb

Defined Under Namespace

Classes: CLI, Crawler

Constant Summary collapse

VERSION =
"4.0.0"

Class Method Summary collapse

Class Method Details

.format_response(hash, format) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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