Sha256: f32be0f8ad85f9d2373ec98f98e351a7444618decae1dcdcdba8051e57d1e815

Contents?: true

Size: 511 Bytes

Versions: 11

Compression:

Stored size: 511 Bytes

Contents

require 'rubygems'
require '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

Version Path
soveran-micromachine-0.0.5 example/micromachine_sample_gem.rb
soveran-micromachine-0.0.6 example/micromachine_sample_gem.rb
soveran-micromachine-0.0.7 example/micromachine_sample_gem.rb
soveran-micromachine-0.0.8 example/micromachine_sample_gem.rb
soveran-micromachine-0.0.9 example/micromachine_sample_gem.rb
micromachine-0.0.11 example/micromachine_sample_gem.rb
micromachine-0.0.10 example/micromachine_sample_gem.rb
micromachine-0.0.8 example/micromachine_sample_gem.rb
micromachine-0.0.9 example/micromachine_sample_gem.rb
micromachine-0.0.6 example/micromachine_sample_gem.rb
micromachine-0.0.7 example/micromachine_sample_gem.rb