micromachine 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/micromachine.rb CHANGED
@@ -13,10 +13,14 @@ class MicroMachine
13
13
  end
14
14
 
15
15
  def trigger event
16
- if transitions_for[event][@state]
16
+ if trigger?(event)
17
17
  @state = transitions_for[event][@state]
18
18
  @callbacks[@state].each { |callback| callback.call }
19
19
  true
20
20
  end
21
21
  end
22
+
23
+ def trigger?(event)
24
+ transitions_for[event][state]
25
+ end
22
26
  end
data/micromachine.gemspec CHANGED
@@ -1,14 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'micromachine'
3
- s.version = '0.0.7'
3
+ s.version = '0.0.8'
4
4
  s.summary = %{Minimal Finite State Machine.}
5
- s.date = %q{2009-03-07}
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"
7
7
  s.email = "michel@soveran.com"
8
8
  s.homepage = "http://github.com/soveran/micromachine"
9
9
  s.files = ["lib/micromachine.rb", "README.markdown", "LICENSE", "Rakefile", "micromachine.gemspec", "example/micromachine_sample.rb", "example/micromachine_sample_gem.rb"]
10
- s.require_paths = ['lib']
11
- s.has_rdoc = false
12
- s.specification_version = 2 if s.respond_to? :specification_version=
13
10
  end
14
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micromachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Martens
@@ -9,11 +9,14 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-07 00:00:00 -02:00
12
+ date: 2009-08-05 00:00:00 -03:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description:
16
+ description: |-
17
+ 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.
18
+
19
+ But 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.
17
20
  email: michel@soveran.com
18
21
  executables: []
19
22
 
@@ -29,8 +32,10 @@ files:
29
32
  - micromachine.gemspec
30
33
  - example/micromachine_sample.rb
31
34
  - example/micromachine_sample_gem.rb
32
- has_rdoc: false
35
+ has_rdoc: true
33
36
  homepage: http://github.com/soveran/micromachine
37
+ licenses: []
38
+
34
39
  post_install_message:
35
40
  rdoc_options: []
36
41
 
@@ -51,9 +56,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
56
  requirements: []
52
57
 
53
58
  rubyforge_project:
54
- rubygems_version: 1.3.1
59
+ rubygems_version: 1.3.4
55
60
  signing_key:
56
- specification_version: 2
61
+ specification_version: 3
57
62
  summary: Minimal Finite State Machine.
58
63
  test_files: []
59
64