Source: show | on GitHub
# File lib/aasm/state_transition.rb, line 5 def initialize(opts) @from, @to, @guard, @on_transition = opts[:from], opts[:to], opts[:guard], opts[:on_transition] @opts = opts end
# File lib/aasm/state_transition.rb, line 27 def ==(obj) @from == obj.from && @to == obj.to end
# File lib/aasm/state_transition.rb, line 21 def execute(obj, *args) @on_transition.is_a?(Array) ? @on_transition.each {|ot| _execute(obj, ot, *args)} : _execute(obj, @on_transition, *args) end
# File lib/aasm/state_transition.rb, line 31 def from?(value) @from == value end
# File lib/aasm/state_transition.rb, line 10 def perform(obj) case @guard when Symbol, String obj.send(@guard) when Proc @guard.call(obj) else true end end