Class: Jsm::Drawer::Digraph
- Inherits:
-
Object
- Object
- Jsm::Drawer::Digraph
- Defined in:
- lib/jsm/drawer/digraph.rb
Overview
list of all nodes
Instance Attribute Summary collapse
-
#state_machine ⇒ Object
readonly
Returns the value of attribute state_machine.
Instance Method Summary collapse
-
#initialize(state_machine) ⇒ Digraph
constructor
A new instance of Digraph.
-
#nodes ⇒ Object
list of all nodes TODO: move it to different class(?).
-
#to_s ⇒ Object
convert it to string that is compatible with api Graphviz.
Constructor Details
#initialize(state_machine) ⇒ Digraph
Returns a new instance of Digraph.
4 5 6 |
# File 'lib/jsm/drawer/digraph.rb', line 4 def initialize(state_machine) @state_machine = state_machine end |
Instance Attribute Details
#state_machine ⇒ Object (readonly)
Returns the value of attribute state_machine.
3 4 5 |
# File 'lib/jsm/drawer/digraph.rb', line 3 def state_machine @state_machine end |
Instance Method Details
#nodes ⇒ Object
list of all nodes TODO: move it to different class(?)
10 11 12 13 14 15 16 |
# File 'lib/jsm/drawer/digraph.rb', line 10 def nodes unless @nodes events = state_machine.events.values @nodes = events.map{ |event| to_nodes(event) }.flatten end @nodes end |
#to_s ⇒ Object
convert it to string that is compatible with api Graphviz
19 20 21 |
# File 'lib/jsm/drawer/digraph.rb', line 19 def to_s nodes.map(&:to_s).join(';') end |