Module: Wedge::Plugins::AbilityList::Helpers
- Included in:
- CurrentUser
- Defined in:
- lib/wedge/plugins/ability_list.rb
Overview
Provides ‘#can?` and `#cannot?` and other helpers. Assumes that you have an `#ability` method defined.
Instance Method Summary collapse
Instance Method Details
#authorize!(*a) ⇒ Object
89 90 91 92 |
# File 'lib/wedge/plugins/ability_list.rb', line 89 def (*a) raise AbilityList::Error.new("No 'ability' defined") unless abilities abilities.(*a) end |
#can?(*a) ⇒ Boolean
81 82 83 |
# File 'lib/wedge/plugins/ability_list.rb', line 81 def can?(*a) abilities && abilities.can?(*a) end |
#cannot?(*a) ⇒ Boolean
85 86 87 |
# File 'lib/wedge/plugins/ability_list.rb', line 85 def cannot?(*a) !abilities || abilities.cannot?(*a) end |