Module: CanTango::Permit::Helper::Execution
- Includes:
- Helpers::Debug, State
- Defined in:
- lib/cantango/permit/helper/execution.rb
Instance Method Summary collapse
- #calc_rules ⇒ Object
-
#execute ⇒ Object
(also: #execute!)
executes the permit.
-
#executor ⇒ Object
return the executor used to execute the permit.
- #mode_rules ⇒ Object
Methods included from State
#disable!, #disabled?, #enable!, #enabled?
Instance Method Details
#calc_rules ⇒ Object
34 35 |
# File 'lib/cantango/permit/helper/execution.rb', line 34 def calc_rules end |
#execute ⇒ Object Also known as: execute!
executes the permit
8 9 10 11 12 13 14 15 |
# File 'lib/cantango/permit/helper/execution.rb', line 8 def execute return if disabled? debug "Execute Permit: #{self}" # check current mode and execute accordingly!? calc_rules mode_rules end |
#executor ⇒ Object
return the executor used to execute the permit
25 26 27 28 29 30 31 32 |
# File 'lib/cantango/permit/helper/execution.rb', line 25 def executor @executor ||= case self.class.name when /System/ then CanTango::Executor::Permit::System.new self else CanTango::Executor::Permit::Base.new self end end |
#mode_rules ⇒ Object
18 19 20 21 22 |
# File 'lib/cantango/permit/helper/execution.rb', line 18 def mode_rules return unless modes.include? mode calc_rules_method = "#{mode}_rules" send(calc_rules_method) if respond_to?(calc_rules_method) end |