Class: Authifer::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/authifer/renderer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#appObject (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 (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