Class: Alephant::Broker::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/alephant/broker.rb

Instance Method Summary collapse

Constructor Details

#initialize(c = nil) ⇒ Application

Returns a new instance of Application.



22
23
24
# File 'lib/alephant/broker.rb', line 22

def initialize(c = nil)
  Broker.config = c unless c.nil?
end

Instance Method Details

#call(env) ⇒ Object



26
27
28
# File 'lib/alephant/broker.rb', line 26

def call(env)
  send response_for(environment_for(env))
end

#environment_for(env) ⇒ Object



30
31
32
# File 'lib/alephant/broker.rb', line 30

def environment_for(env)
  Environment.new env
end

#response_for(call_environment) ⇒ Object



34
35
36
# File 'lib/alephant/broker.rb', line 34

def response_for(call_environment)
  Broker.handle call_environment
end

#send(response) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/alephant/broker.rb', line 38

def send(response)
  [
    response.status,
    { "Content-Type" => response.content_type },
    [ response.content.to_s ]
  ]
end