lib/transitions/machine.rb in transitions-1.2.1 vs lib/transitions/machine.rb in transitions-1.3.0
- old
+ new
@@ -25,13 +25,13 @@
end
#
# rubocop:disable Metrics/MethodLength
#
- def fire_event(event, record, persist, *args)
+ def fire_event(event, record, persist, *args, **kwargs)
handle_state_exit_callback record
- if new_state = transition_to_new_state(record, event, *args)
+ if new_state = transition_to_new_state(record, event, *args, **kwargs)
handle_state_enter_callback record, new_state
handle_event_fired_callback record, new_state, event
record.update_current_state(new_state, persist)
handle_event_success_callback record, event
return true
@@ -59,12 +59,12 @@
def handle_state_exit_callback(record)
state_index[record.current_state].call_action(:exit, record)
end
- def transition_to_new_state(record, event, *args)
- @events[event].fire(record, nil, *args)
+ def transition_to_new_state(record, event, *args, **kwargs)
+ @events[event].fire(record, nil, *args, **kwargs)
end
def handle_state_enter_callback(record, new_state)
state_index[new_state].call_action(:enter, record)
end
@@ -93,10 +93,10 @@
def event(name, options = {}, &block)
(@events[name] ||= Event.new(self, name)).update(options, &block)
end
- # :reek:TooManyStatements: { max_statements: 7 }
+ # :reek:TooManyStatements { max_statements: 7 }
def include_scopes
@states.each do |state|
state_name = state.name.to_s
if @klass.respond_to?(state_name)
fail InvalidMethodOverride,