Sha256: a175b9d14e6c81af4f9d1e15721d3333579062f5b2f59e2bd7d679ceff8648eb
Contents?: true
Size: 471 Bytes
Versions: 14
Compression:
Stored size: 471 Bytes
Contents
class LightSwitch include DataMapper::Resource property :id, Serial property :type, Discriminator is :state_machine, :initial => :off do state :off state :on, :enter => :on_hook event :switch do transition :from => :on, :to => :off transition :from => :off, :to => :on end end def on_hook puts "Light turned on!" end end class Dimmer < LightSwitch def on_hook puts "Lights! Camera! Action! your're on!" end end
Version data entries
14 entries across 14 versions & 2 rubygems