Class: RubyApp::Request
- Extended by:
- Mixins::DelegateMixin
- Defined in:
- lib/ruby_app/request.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
Class Method Summary collapse
- .create!(environment = RubyApp::Application.environment) ⇒ Object
- .create_context! ⇒ Object
- .destroy! ⇒ Object
- .exists? ⇒ Boolean
- .get ⇒ Object
Instance Method Summary collapse
Methods included from Mixins::DelegateMixin
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
12 13 14 |
# File 'lib/ruby_app/request.rb', line 12 def environment @environment end |
Class Method Details
.create!(environment = RubyApp::Application.environment) ⇒ Object
35 36 37 |
# File 'lib/ruby_app/request.rb', line 35 def self.create!(environment = RubyApp::Application.environment) return Thread.current[:_request] = RubyApp::Request.new(environment) end |
.create_context! ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/ruby_app/request.rb', line 43 def self.create_context! unless RubyApp::Request.exists? RubyApp::Request.create! RubyApp::Response.create! RubyApp::Language.load! RubyApp::Session.load! begin yield ensure RubyApp::Session.unload! RubyApp::Language.unload! RubyApp::Response.destroy! RubyApp::Request.destroy! end end end |
.destroy! ⇒ Object
39 40 41 |
# File 'lib/ruby_app/request.rb', line 39 def self.destroy! return Thread.current[:_request] = nil end |
.exists? ⇒ Boolean
31 32 33 |
# File 'lib/ruby_app/request.rb', line 31 def self.exists? return Thread.current[:_request] end |
.get ⇒ Object
27 28 29 |
# File 'lib/ruby_app/request.rb', line 27 def self.get return Thread.current[:_request] end |
Instance Method Details
#language ⇒ Object
14 15 16 17 |
# File 'lib/ruby_app/request.rb', line 14 def language self.path.gsub(/^#{RubyApp::Application.root_or_nil}/,'') =~ /^\/([^\/\?]+)/ return $1 end |
#parameters ⇒ Object
23 24 25 |
# File 'lib/ruby_app/request.rb', line 23 def parameters return self.params end |
#query ⇒ Object
19 20 21 |
# File 'lib/ruby_app/request.rb', line 19 def query return ::Rack::Utils.parse_query(self.query_string) end |