Class: Authifer::Renderer
- Inherits:
-
Object
- Object
- Authifer::Renderer
- Defined in:
- lib/authifer/renderer.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
-
#initialize(app) ⇒ Renderer
constructor
A new instance of Renderer.
- #login(user) ⇒ Object
- #register(user) ⇒ Object
Constructor Details
#initialize(app) ⇒ Renderer
Returns a new instance of Renderer.
5 6 7 |
# File 'lib/authifer/renderer.rb', line 5 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
3 4 5 |
# File 'lib/authifer/renderer.rb', line 3 def app @app end |
Instance Method Details
#login(user) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/authifer/renderer.rb', line 9 def login(user) if app.logged_in? app.redirect app.redirect_url else app.erb :new_session, locals: { user: user } end end |
#register(user) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/authifer/renderer.rb', line 17 def register(user) if app.logged_in? app.redirect app.redirect_url else app.erb :new_user, locals: { user: user } end end |