1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00
aasm/spec/models/process_with_new_dsl.rb

32 lines
519 B
Ruby
Raw Normal View History

class ProcessWithNewDsl
include AASM
def self.state(*args)
raise "wrong state method"
end
attr_accessor :flagged
aasm do
state :sleeping, :initial => true
state :running, :after_enter => :flag
state :suspended
event :start do
transitions :from => :sleeping, :to => :running
end
event :stop do
transitions :from => :running, :to => :suspended
end
end
def flag
self.flagged = true
end
def self.event(*args)
raise "wrong event method"
end
end