class Vehicle
state_machine :state, initial: :parked do
...
event :crash do
transition all - [:parked, :stalled] => :stalled, if: ->(vehicle, kwargs) {kwargs[:arg] == true} # kwargs from event fire
end
end
end
vehicle = Vehicle.new
vehicle.crash(arg: false) # false
Add passing kwargs from event to guard