Module: CanTango::ClassMethods

Included in:
CanTango
Defined in:
lib/cantango/permits_ext/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#clear_permits_executed!Object



23
24
25
# File 'lib/cantango/permits_ext/class_methods.rb', line 23

def clear_permits_executed!
  config.permits.clear_executed!
end

#debug_ability(candidate, actions, subjects, *extra_args) ⇒ Object



17
18
19
20
21
# File 'lib/cantango/permits_ext/class_methods.rb', line 17

def debug_ability candidate, actions, subjects, *extra_args
  puts "Ability: #{actions} on #{subjects}"
  puts "permits allowed:" << permits_allowed(candidate, actions, subjects, *extra_args).inspect
  puts "permits denied:"  << permits_denied(candidate, actions, subjects, *extra_args).inspect
end

#debug_permits_registryObject



13
14
15
# File 'lib/cantango/permits_ext/class_methods.rb', line 13

def debug_permits_registry
  puts "permits registry:" << CanTango.config.permits.show_all.inspect
end

#permits_allowed(candidate, actions, subjects, *extra_args) ⇒ Object



3
4
5
6
# File 'lib/cantango/permits_ext/class_methods.rb', line 3

def permits_allowed candidate, actions, subjects, *extra_args
  raise "Debugging has not been turned on. Turn it on using: CanTango.debug!" if CanTango.config.debug.off?
  config.permits.allowed candidate, actions, subjects, *extra_args
end

#permits_denied(candidate, actions, subjects, *extra_args) ⇒ Object



8
9
10
11
# File 'lib/cantango/permits_ext/class_methods.rb', line 8

def permits_denied candidate, actions, subjects, *extra_args
  raise "Debugging has not been turned on. Turn it on using: CanTango.debug!" if CanTango.config.debug.off?
  config.permits.denied candidate, actions, subjects, *extra_args
end