Sha256: 2c67d687d096871897608d50f2a40af65d40626505762ccaad2431c7c27abd2e

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

require File.dirname(__FILE__) + '/../../lib/fsm'
class Ticket
  attr_accessor(:state)
  include FSM
  define_fsm do
    states(:created, :reserved, :sold, :invalid, :inside, :outside)
    
    transition(:reserve, :created, :reserved)
    transition(:buy, :reserved, :sold)
    
    transition(:enter, :sold, :inside)
    transition(:enter, :outside, :inside)
    transition(:exit, :inside, :outside)
    
    transition(:invalidate, [:created, :reserved, :inside, :outside], :invalid)
  end
  
end

t = Ticket.fsm_draw_graph(:format => 'png')

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simplificator-fsm-0.3.9 samples/ticket/ticket_sample.rb
simplificator-fsm-0.3.8 samples/ticket/ticket_sample.rb
simplificator-fsm-0.3.7 samples/ticket/ticket_sample.rb