Class: RubyApp::Request
- Inherits:
-
Rack::Request
- Object
- Rack::Request
- RubyApp::Request
- Extended by:
- Mixins::DelegateMixin
- Defined in:
- lib/ruby_app/request.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Mixins::DelegateMixin
Class Method Details
.create!(environment = RubyApp::Application.environment) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ruby_app/request.rb', line 33 def self.create!(environment = RubyApp::Application.environment) Thread.current[:_request] = RubyApp::Request.new(environment) Thread.current[:_rendered] = {} if block_given? begin RubyApp::Language.load! do RubyApp::Session.create! do return yield end end ensure self.destroy! end else begin RubyApp::Language.load! begin RubyApp::Session.create! rescue RubyApp::Language.unload! raise end rescue self.destroy! raise end end end |
.destroy! ⇒ Object
64 65 66 67 |
# File 'lib/ruby_app/request.rb', line 64 def self.destroy! Thread.current[:_rendered] = nil Thread.current[:_request] = nil end |
.get ⇒ Object
29 30 31 |
# File 'lib/ruby_app/request.rb', line 29 def self.get Thread.current[:_request] end |
Instance Method Details
#language ⇒ Object
16 17 18 19 |
# File 'lib/ruby_app/request.rb', line 16 def language self.fullpath =~ /^\/([^\/\?]+)/ $1 || RubyApp::Application..default_language end |
#parameters ⇒ Object
25 26 27 |
# File 'lib/ruby_app/request.rb', line 25 def parameters self.params end |
#query ⇒ Object
21 22 23 |
# File 'lib/ruby_app/request.rb', line 21 def query ::Rack::Utils.parse_query(self.query_string) end |