Class: SwitchUser::Provider::Dummy

Inherits:
Base
  • Object
show all
Defined in:
lib/switch_user/provider/dummy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#clear_original_user, #current_user?, #current_users_without_scope, #login_exclusive, #login_inclusive, #logout_all, #original_user=

Constructor Details

#initialize(_controller) ⇒ Dummy

Returns a new instance of Dummy.



6
7
8
# File 'lib/switch_user/provider/dummy.rb', line 6

def initialize(_controller)
  @user = nil
end

Instance Attribute Details

#original_userObject (readonly)

Returns the value of attribute original_user.



22
23
24
# File 'lib/switch_user/provider/dummy.rb', line 22

def original_user
  @original_user
end

Instance Method Details

#current_user(_scope = nil) ⇒ Object



18
19
20
# File 'lib/switch_user/provider/dummy.rb', line 18

def current_user(_scope = nil)
  @user
end

#login(user, _scope = nil) ⇒ Object



10
11
12
# File 'lib/switch_user/provider/dummy.rb', line 10

def (user, _scope = nil)
  @user = user
end

#logout(_scope = nil) ⇒ Object



14
15
16
# File 'lib/switch_user/provider/dummy.rb', line 14

def logout(_scope = nil)
  @user = nil
end

#remember_current_user(remember) ⇒ Object



24
25
26
# File 'lib/switch_user/provider/dummy.rb', line 24

def remember_current_user(remember)
  @original_user = (current_user if remember)
end