examples/callbacks.rb in microfsm-0.1.3 vs examples/callbacks.rb in microfsm-0.1.4
- old
+ new
@@ -1,14 +1,14 @@
-require 'microfsm'
+require "microfsm"
# This example can be run with ruby -I lib/ ./examples/callbacks.rb
fsm = MicroFSM.new(:pending)
- .when(:confirm, :pending => :confirmed) { puts "Confirmed" }
- .when(:ignore, :pending => :ignored) { puts "Ignored" }
- .when(:reset, :confirmed => :pending, :ignored => :pending) {
- puts "Reset"
- }
+ .when(:confirm, pending: :confirmed) { puts "Confirmed" }
+ .when(:ignore, pending: :ignored) { puts "Ignored" }
+ .when(:reset, confirmed: :pending, ignored: :pending) {
+ puts "Reset"
+}
puts "Should print Confirmed, Reset and Ignored:"
fsm.trigger(:confirm)
fsm.trigger(:ignore)
fsm.trigger(:reset)