Class: WelltreatStoreFramework::Controller::Request
- Inherits:
-
Object
- Object
- WelltreatStoreFramework::Controller::Request
- Defined in:
- lib/welltreat_store_framework/controller.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#rack_request ⇒ Object
Returns the value of attribute rack_request.
Class Method Summary collapse
Instance Method Summary collapse
- #[](k) ⇒ Object
- #get_header(k) ⇒ Object
-
#initialize(attrs = { }) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(attrs = { }) ⇒ Request
Returns a new instance of Request.
33 34 35 36 37 38 39 40 41 |
# File 'lib/welltreat_store_framework/controller.rb', line 33 def initialize(attrs = { }) @headers = { } @params = { } @path = nil @rack_request = nil attrs.each do |k, v| self.send(:"#{k.to_s}=", v) end end |
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
31 32 33 |
# File 'lib/welltreat_store_framework/controller.rb', line 31 def env @env end |
#headers ⇒ Object
Returns the value of attribute headers.
31 32 33 |
# File 'lib/welltreat_store_framework/controller.rb', line 31 def headers @headers end |
#params ⇒ Object
Returns the value of attribute params.
31 32 33 |
# File 'lib/welltreat_store_framework/controller.rb', line 31 def params @params end |
#path ⇒ Object
Returns the value of attribute path.
31 32 33 |
# File 'lib/welltreat_store_framework/controller.rb', line 31 def path @path end |
#rack_request ⇒ Object
Returns the value of attribute rack_request.
31 32 33 |
# File 'lib/welltreat_store_framework/controller.rb', line 31 def rack_request @rack_request end |
Class Method Details
.initialize_from_env(env) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/welltreat_store_framework/controller.rb', line 52 def initialize_from_env(env) request = Rack::Request.new(env) self.new( :params => request.params, :headers => env, :rack_request => request, :path => request.path, :env => env ) end |
Instance Method Details
#[](k) ⇒ Object
47 48 49 |
# File 'lib/welltreat_store_framework/controller.rb', line 47 def [](k) self.params[k] end |
#get_header(k) ⇒ Object
43 44 45 |
# File 'lib/welltreat_store_framework/controller.rb', line 43 def get_header(k) self.headers[k] end |