Module: CanTango::Api::Ability::Account::AbilityAccount

Defined in:
lib/cantango/api/ability/account.rb

Class Method Summary collapse

Class Method Details

.guestObject



37
38
39
40
41
42
# File 'lib/cantango/api/ability/account.rb', line 37

def self.guest
   = CanTango.config.guest.

  raise "You must set the guest_account to a Proc or lambda in CanTango.config" if !
  .respond_to?(:call) ? .call : 
end

.is_account?(account) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/cantango/api/ability/account.rb', line 33

def self.is_account? 
  ::CanTango.config.accounts.registered_class? .class
end

.resolve_account(obj) ⇒ Object

test if current_xxx actually returns an account and not a user instance! if so call the #account method on the user



27
28
29
30
31
# File 'lib/cantango/api/ability/account.rb', line 27

def self. obj
  return obj if AbilityAccount.is_account?(obj)
  return (obj.send(:account)) if obj.respond_to?(:account)
  guest
end