module Indulgence::Indulgent::ClassMethods

Public Instance Methods

indulge?(entity, ability) click to toggle source
# File lib/indulgence/indulgent.rb, line 12
def indulge?(entity, ability)
  new.indulge?(entity, ability)
end
indulgence(entity, ability) click to toggle source
# 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

Private Instance Methods

raise_not_found() click to toggle source
# File lib/indulgence/indulgent.rb, line 17
def raise_not_found
  raise ActiveRecord::RecordNotFound.new('Unable to find the item(s) you were looking for')
end