Class: Mumukit::Login::Controller
- Inherits:
-
Object
- Object
- Mumukit::Login::Controller
- Defined in:
- lib/mumukit/login/controller.rb
Instance Method Summary collapse
- #delete_cookie!(key, domain) ⇒ Object
- #env ⇒ Object
-
#initialize(framework, native) ⇒ Controller
constructor
A new instance of Controller.
- #mucookie ⇒ Object
- #read_cookie(key) ⇒ Object
- #redirect!(path) ⇒ Object
- #render_html!(html) ⇒ Object
- #request ⇒ Object
- #session ⇒ Object
- #shared_session ⇒ Object
- #url_for(path) ⇒ Object
- #write_cookie!(key, value) ⇒ Object
Constructor Details
#initialize(framework, native) ⇒ Controller
Returns a new instance of Controller.
2 3 4 5 |
# File 'lib/mumukit/login/controller.rb', line 2 def initialize(framework, native) @framework = framework @native = native end |
Instance Method Details
#delete_cookie!(key, domain) ⇒ Object
51 52 53 |
# File 'lib/mumukit/login/controller.rb', line 51 def (key, domain) @framework. key, domain, @native end |
#env ⇒ Object
31 32 33 |
# File 'lib/mumukit/login/controller.rb', line 31 def env @framework.env @native end |
#mucookie ⇒ Object
15 16 17 |
# File 'lib/mumukit/login/controller.rb', line 15 def @mucookie ||= Mumukit::Login::Mucookie.new self end |
#read_cookie(key) ⇒ Object
47 48 49 |
# File 'lib/mumukit/login/controller.rb', line 47 def (key) @framework. key, @native end |
#redirect!(path) ⇒ Object
35 36 37 |
# File 'lib/mumukit/login/controller.rb', line 35 def redirect!(path) @framework.redirect!(path, @native) end |
#render_html!(html) ⇒ Object
39 40 41 |
# File 'lib/mumukit/login/controller.rb', line 39 def render_html!(html) @framework.render_html!(html, @native) end |
#request ⇒ Object
23 24 25 |
# File 'lib/mumukit/login/controller.rb', line 23 def request Rack::Request.new(env) end |
#session ⇒ Object
27 28 29 |
# File 'lib/mumukit/login/controller.rb', line 27 def session request.session end |
#shared_session ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/mumukit/login/controller.rb', line 7 def shared_session if env['HTTP_AUTHORIZATION'] Mumukit::Login::TokenSharedSession.new env else Mumukit::Login::MucookieSharedSession.new end end |
#url_for(path) ⇒ Object
19 20 21 |
# File 'lib/mumukit/login/controller.rb', line 19 def url_for(path) URI.join(request.base_url, path).to_s end |
#write_cookie!(key, value) ⇒ Object
43 44 45 |
# File 'lib/mumukit/login/controller.rb', line 43 def (key, value) @framework. key, value, @native end |