Class: Alephant::Broker::Environment
- Inherits:
-
Object
- Object
- Alephant::Broker::Environment
- Includes:
- Logger
- Defined in:
- lib/alephant/broker/environment.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #data ⇒ Object
- #get? ⇒ Boolean
-
#initialize(env) ⇒ Environment
constructor
A new instance of Environment.
- #method ⇒ Object
- #options ⇒ Object
- #path ⇒ Object
- #post? ⇒ Boolean
- #query ⇒ Object
Constructor Details
#initialize(env) ⇒ Environment
Returns a new instance of Environment.
10 11 12 |
# File 'lib/alephant/broker/environment.rb', line 10 def initialize(env) @settings = env end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
8 9 10 |
# File 'lib/alephant/broker/environment.rb', line 8 def settings @settings end |
Instance Method Details
#data ⇒ Object
41 42 43 |
# File 'lib/alephant/broker/environment.rb', line 41 def data parse(rack_input) if post? end |
#get? ⇒ Boolean
22 23 24 |
# File 'lib/alephant/broker/environment.rb', line 22 def get? settings['REQUEST_METHOD'] == 'GET' end |
#method ⇒ Object
14 15 16 |
# File 'lib/alephant/broker/environment.rb', line 14 def method settings['REQUEST_METHOD'] end |
#options ⇒ Object
30 31 32 33 34 35 |
# File 'lib/alephant/broker/environment.rb', line 30 def query.split('&').reduce({}) do |object, key_pair| key, value = key_pair.split('=') object.tap { |o| o.store(key.to_sym, value) } end end |
#path ⇒ Object
37 38 39 |
# File 'lib/alephant/broker/environment.rb', line 37 def path settings['PATH_INFO'] end |
#post? ⇒ Boolean
18 19 20 |
# File 'lib/alephant/broker/environment.rb', line 18 def post? settings['REQUEST_METHOD'] == 'POST' end |
#query ⇒ Object
26 27 28 |
# File 'lib/alephant/broker/environment.rb', line 26 def query settings['QUERY_STRING'] || "" end |