Class: Browser::Middleware::Context
- Inherits:
-
Object
- Object
- Browser::Middleware::Context
- Defined in:
- lib/browser/middleware/context.rb,
lib/browser/middleware/context/additions.rb,
lib/browser/middleware/context/url_methods.rb
Defined Under Namespace
Modules: Additions, UrlMethods
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(request) ⇒ Context
constructor
A new instance of Context.
- #redirect_to(path) ⇒ Object
Constructor Details
#initialize(request) ⇒ Context
Returns a new instance of Context.
7 8 9 10 11 12 13 14 |
# File 'lib/browser/middleware/context.rb', line 7 def initialize(request) @request = request @browser = Browser.new( request.user_agent, accept_language: request.env["HTTP_ACCEPT_LANGUAGE"] ) end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
5 6 7 |
# File 'lib/browser/middleware/context.rb', line 5 def browser @browser end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'lib/browser/middleware/context.rb', line 5 def request @request end |
Instance Method Details
#redirect_to(path) ⇒ Object
16 17 18 |
# File 'lib/browser/middleware/context.rb', line 16 def redirect_to(path) throw :redirected, path.to_s end |