File: switch.rb

package info (click to toggle)
ruby-state-machine 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,764 kB
  • ctags: 6,623
  • sloc: ruby: 26,008; makefile: 11
file content (15 lines) | stat: -rw-r--r-- 230 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Switch
  def self.name
    @name ||= "Switch_#{rand(1000000)}"
  end
  
  state_machine do
    event :turn_on do
      transition all => :on
    end
    
    event :turn_off do
      transition all => :off
    end
  end
end