Module: CanTango::Api::Masquerade::Account
- Defined in:
- lib/cantango/masquerade/api/masquerade/account.rb
Instance Attribute Summary collapse
-
#active_account ⇒ Object
readonly
Returns the value of attribute active_account.
-
#masquerading ⇒ Object
readonly
Returns the value of attribute masquerading.
Instance Method Summary collapse
Instance Attribute Details
#active_account ⇒ Object (readonly)
Returns the value of attribute active_account.
5 6 7 |
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 5 def active_account @active_account end |
#masquerading ⇒ Object (readonly)
Returns the value of attribute masquerading.
5 6 7 |
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 5 def masquerading @masquerading end |
Instance Method Details
#masquerade_as(account) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 7 def masquerade_as account raise "Must be a registered type of account, was: #{account}" unless valid_account? account @masquerading = true @active_account = account self end |
#masquerading? ⇒ Boolean
19 20 21 |
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 19 def masquerading? !@masquerading.nil? end |
#stop_masquerade ⇒ Object
14 15 16 17 |
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 14 def stop_masquerade @active_account, @masquerading = nil, nil self end |