Class: Alephant::Broker::Application
- Inherits:
-
Object
- Object
- Alephant::Broker::Application
- Defined in:
- lib/alephant/broker.rb
Instance Attribute Summary collapse
-
#load_strategy ⇒ Object
readonly
Returns the value of attribute load_strategy.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #environment_for(env) ⇒ Object
-
#initialize(load_strategy, c = nil) ⇒ Application
constructor
A new instance of Application.
- #response_for(call_environment) ⇒ Object
- #send(response) ⇒ Object
Constructor Details
#initialize(load_strategy, c = nil) ⇒ Application
Returns a new instance of Application.
24 25 26 27 |
# File 'lib/alephant/broker.rb', line 24 def initialize(load_strategy, c = nil) Broker.config = c unless c.nil? @load_strategy = load_strategy end |
Instance Attribute Details
#load_strategy ⇒ Object (readonly)
Returns the value of attribute load_strategy.
22 23 24 |
# File 'lib/alephant/broker.rb', line 22 def load_strategy @load_strategy end |
Instance Method Details
#call(env) ⇒ Object
29 30 31 |
# File 'lib/alephant/broker.rb', line 29 def call(env) send response_for(environment_for(env)) end |
#environment_for(env) ⇒ Object
33 34 35 |
# File 'lib/alephant/broker.rb', line 33 def environment_for(env) Environment.new env end |
#response_for(call_environment) ⇒ Object
37 38 39 |
# File 'lib/alephant/broker.rb', line 37 def response_for(call_environment) Broker.handle(load_strategy, call_environment) end |
#send(response) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/alephant/broker.rb', line 41 def send(response) [ response.status, response.headers, [ response.content.to_s ] ] end |