Sha256: 23aa98e1d870afe4245e752c44a5ea462b41517ecc632918f364e8a7e0920ef3
Contents?: true
Size: 534 Bytes
Versions: 11
Compression:
Stored size: 534 Bytes
Contents
require File.join(File.dirname(__FILE__), '../lib/micromachine') fsm = MicroMachine.new(:pending) fsm.transitions_for[:confirm] = { :pending => :confirmed } fsm.transitions_for[:ignore] = { :pending => :ignored } fsm.transitions_for[:reset] = { :confirmed => :pending, :ignored => :pending } puts "Should print Confirmed, Reset and Ignored." if fsm.trigger(:confirm) puts "Confirmed" end if fsm.trigger(:ignore) puts "Ignored" end if fsm.trigger(:reset) puts "Reset" end if fsm.trigger(:ignore) puts "Ignored" end
Version data entries
11 entries across 11 versions & 2 rubygems