Sha256: b02d58632a8bd373330d19b23c1ed51f7718592fe2295bb99b91ba7758f3f8cb
Contents?: true
Size: 546 Bytes
Versions: 3
Compression:
Stored size: 546 Bytes
Contents
require 'micromachine' # This example can be run with ruby -I lib/ ./examples/callbacks.rb fsm = MicroMachine.new(:pending) fsm.when(:confirm, :pending => :confirmed) fsm.when(:ignore, :pending => :ignored) fsm.when(:reset, :confirmed => :pending, :ignored => :pending) puts "Should print Confirmed, Reset and Ignored:" fsm.on(:confirmed) do puts "Confirmed" end fsm.on(:ignored) do puts "Ignored" end fsm.on(:pending) do puts "Reset" end fsm.trigger(:confirm) fsm.trigger(:ignore) fsm.trigger(:reset) fsm.trigger(:ignore)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
micromachine-3.0.0 | examples/callbacks.rb |
micromachine-2.1.0 | examples/callbacks.rb |
micromachine-2.0.0 | examples/callbacks.rb |