lib/transitions/state_transition.rb in transitions-0.0.9 vs lib/transitions/state_transition.rb in transitions-0.0.10

- old
+ new

@@ -44,9 +44,18 @@ case @on_transition when Symbol, String obj.send(@on_transition, *args) when Proc @on_transition.call(obj, *args) + when Array + @on_transition.each do |callback| + # Yes, we're passing always the same parameters for each callback in here. + # We should probably drop args altogether in case we get an array. + obj.send(callback, *args) + end + else + # TODO We probably should check for this in the constructor and not that late. + raise ArgumentError, "You can only pass a Symbol, a String, a Proc or an Array to 'on_transition' - got #{@on_transition.class}." unless @on_transition.nil? end end def ==(obj) @from == obj.from && @to == obj.to