soveran-micromachine 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'micromachine'
3
- s.version = '0.0.8'
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soveran-micromachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens