simplificator-fsm 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -42,5 +42,19 @@ FSM is a simple finite state machine
42
42
  w.cool_down # again... it's the name of the transition
43
43
  w.state_of_material
44
44
 
45
+ ## Graphviz / Dot format
46
+ FSM supports the dot format of graphviz (http://www.graphviz.org/).
47
+ If you have the graphviz tools installed (the dot executable must be on the path) then
48
+ you can export a graph to png like this
49
+ # Export to water.png in the current dir
50
+ Water.dot
51
+ # Export in another format. (see graphviz documentation for supported file formats)
52
+ Water.dot(:format => :foo)
53
+ # Change the extension (defaults to the format)
54
+ Water.dot(:format => :jpg, :extension => :jpeg)
55
+ # Specify a custom file
56
+ Water.dot(:outfile => '/afile.png')
57
+
58
+
45
59
  ## Copyright
46
60
  Copyright (c) 2009 simplificator GmbH. See LICENSE for details.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 3
4
+ :patch: 4
data/lib/fsm.rb CHANGED
@@ -16,6 +16,13 @@ module FSM
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ def dot(options = {})
21
+ machine = Machine[self]
22
+ raise 'No FSM defined. Call define_fsm first' unless machine
23
+ machine.dot(options)
24
+ end
25
+
19
26
  end
20
27
 
21
28
  module InstanceMethods
@@ -30,7 +30,6 @@ class Water
30
30
  end
31
31
  def on_exit_solid()
32
32
  end
33
-
34
33
  end
35
34
 
36
35
  class WaterSampleTest < Test::Unit::TestCase
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplificator-fsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - simplificator