micromachine 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/micromachine.rb +4 -0
- data/micromachine.gemspec +1 -1
- metadata +1 -1
data/lib/micromachine.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class MicroMachine
|
2
|
+
InvalidEvent = Class.new(NoMethodError)
|
3
|
+
|
2
4
|
attr :transitions_for
|
3
5
|
attr :state
|
4
6
|
|
@@ -22,5 +24,7 @@ class MicroMachine
|
|
22
24
|
|
23
25
|
def trigger?(event)
|
24
26
|
transitions_for[event][state]
|
27
|
+
rescue NoMethodError
|
28
|
+
raise InvalidEvent
|
25
29
|
end
|
26
30
|
end
|
data/micromachine.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'micromachine'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.9'
|
4
4
|
s.summary = %{Minimal Finite State Machine.}
|
5
5
|
s.description = %Q{There are many finite state machine implementations for Ruby, and they all provide a nice DSL for declaring events, exceptions, callbacks, and all kinds of niceties in general.\n\nBut if all you want is a finite state machine, look no further: this is only 22 lines of code and provides everything a finite state machine must have, and nothing more.}
|
6
6
|
s.author = "Michel Martens"
|