Class: What::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/what/server.rb

Instance Method Summary collapse

Constructor Details

#initializeServer

Returns a new instance of Server.



2
3
4
5
# File 'lib/what/server.rb', line 2

def initialize
  What::Modules.load_all
  What::Monitor.go!
end

Instance Method Details

#call(_) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/what/server.rb', line 7

def call(_)
  [
    What::Status[:health] != :alert ? 200 : 503,
    {'Content-Type' => 'application/json'},
    JSON.unparse(What::Status.all) + "\n"
  ]
end