Sha256: 7c8e7c997a32ccfa40dcaa1561dc659da6f9b784578c02e5730d1d1b6a98ae50
Contents?: true
Size: 976 Bytes
Versions: 13
Compression:
Stored size: 976 Bytes
Contents
module StateMachines::Vacancy def self.included(base) base.extend ClassMethods base.class_eval do attr_accessor :current_user const_set 'STATES', [:open, :recommended, :denied, :closed] const_set 'EVENTS', [:accept_recommendation, :deny_recommendation, :close, :reopen] state_machine :state, initial: :new do event :recommend do transition :new => :recommended end event :accept_recommendation do transition :recommended => :open end event :deny_recommendation do transition :recommended => :denied end event :do_open do transition :new => :open end event :close do transition :open => :closed end event :reopen do transition [:denied, :closed] => :open end end end end module ClassMethods end end
Version data entries
13 entries across 13 versions & 1 rubygems