Class: Alephant::Broker::Application
- Inherits:
-
Object
- Object
- Alephant::Broker::Application
- Defined in:
- lib/alephant/broker.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
- #environment_for(env) ⇒ Object
-
#initialize(c = nil) ⇒ Application
constructor
A new instance of Application.
- #response_for(call_environment) ⇒ Object
- #send(response) ⇒ Object
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 |