Module: Indulgence::Indulgent::ClassMethods

Defined in:
lib/indulgence/indulgent.rb

Instance Method Summary collapse

Instance Method Details

#indulge?(entity, ability) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/indulgence/indulgent.rb', line 12

def indulge?(entity, ability)
  new.indulge?(entity, ability)
end

#indulgence(entity, ability) ⇒ Object



5
6
7
8
9
10
# File 'lib/indulgence/indulgent.rb', line 5

def indulgence(entity, ability)
  permission = indulgent_permission_class.new(entity, ability)
  permission.filter_many(self)
rescue Indulgence::NotFoundError, Indulgence::AbilityNotFound
  raise_not_found
end