lib/event.rb in runcoderun-aasm-2.0.2.2 vs lib/event.rb in runcoderun-aasm-2.0.2.3

- old
+ new

@@ -30,9 +30,20 @@ def transitions_from_state?(state) @transitions.any? { |t| t.from == state } end + def execute_success_callback(obj) + case success + when String, Symbol: + obj.send(success) + when Array: + success.each { |meth| obj.send(meth) } + when Proc: + success.call(obj) + end + end + private def transitions(trans_opts) Array(trans_opts[:from]).each do |s| @transitions << SupportingClasses::StateTransition.new(trans_opts.merge({:from => s.to_sym})) end