Sha256: 651c16ac13a38177c080fde2c52cb37dadaf80cbfef6f3ecfa2749913d842a05
Contents?: true
Size: 882 Bytes
Versions: 17
Compression:
Stored size: 882 Bytes
Contents
# A valid example class SlotMachine include DataMapper::Resource property :id, Serial property :power_on, Boolean, :default => false is :state_machine, :initial => :off, :column => :mode do state :off, :enter => :power_down, :exit => :power_up state :idle state :spinning state :report_loss state :report_win state :pay_out event :pull_crank do transition :from => :idle, :to => :spinning end event :turn_off do transition :from => :idle, :to => :off end event :turn_on do transition :from => :off, :to => :idle end end def initialize(attributes = {}) @log = [] super end def power_up self.power_on = true @log << [:power_up, Time.now] end def power_down self.power_on = false @log << [:power_down, Time.now] end end SlotMachine.auto_migrate!
Version data entries
17 entries across 17 versions & 2 rubygems