module Wedge::Plugins::AbilityList::Helpers

Provides `#can?` and `#cannot?` and other helpers. Assumes that you have an `#ability` method defined.

Public Instance Methods

authorize!(*a) click to toggle source
# File lib/wedge/plugins/ability_list.rb, line 101
def authorize!(*a)
  raise AbilityList::Error.new("No 'ability' defined") unless abilities
  abilities.authorize!(*a)
end
can?(*a) click to toggle source
# File lib/wedge/plugins/ability_list.rb, line 93
def can?(*a)
  abilities && abilities.can?(*a)
end
cannot?(*a) click to toggle source
# File lib/wedge/plugins/ability_list.rb, line 97
def cannot?(*a)
  !abilities || abilities.cannot?(*a)
end