Module: Capricorn::Actor::Actions

Included in:
Capricorn::Actor
Defined in:
lib/capricorn/actor/actions.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/capricorn/actor/actions.rb', line 6

def self.included(base)
  base.extend Capricorn::Actor::Actions::ClassMethods
end

Instance Method Details

#run_callbacks!(action) ⇒ Object

run the callbacks registerd to action. the will run the before, on and after fases.



11
12
13
14
15
16
# File 'lib/capricorn/actor/actions.rb', line 11

def run_callbacks!(action)
  action = action.to_sym
  run_callbacks_in_fase! action, :before
  run_callbacks_in_fase! action, :on
  run_callbacks_in_fase! action, :after
end

#run_callbacks_in_fase!(action, fase) ⇒ Object

run the callbacks registerd to action in the fase



19
20
21
22
23
# File 'lib/capricorn/actor/actions.rb', line 19

def run_callbacks_in_fase!(action, fase)
  action = action.to_sym
  fase   = fase.to_sym
  self.class.methods_for(action, fase).each { |meth| self.send(meth) }
end