Class: Hydrangea::Flow
- Inherits:
-
Object
- Object
- Hydrangea::Flow
- Defined in:
- lib/hydrangea/flow.rb
Instance Method Summary collapse
-
#initialize(graph) ⇒ Flow
constructor
A new instance of Flow.
- #map_each(states = SUCCESS) ⇒ Object
- #map_list(states = SUCCESS) {|ListOfNodes.new(pgt)| ... } ⇒ Object
- #map_values(states = SUCCESS) {|NodesByValue.new(pgt)| ... } ⇒ Object
- #sink(states = SUCCESS) ⇒ Object
Constructor Details
#initialize(graph) ⇒ Flow
Returns a new instance of Flow.
9 10 11 |
# File 'lib/hydrangea/flow.rb', line 9 def initialize(graph) @graph = graph end |
Instance Method Details
#map_each(states = SUCCESS) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/hydrangea/flow.rb', line 13 def map_each(states = SUCCESS) pgt = PartialGraphTransform.new(@graph, states) pgt.untransformed.each do |node| yield SingleNode.new(pgt, node) end self.class.new(pgt.finish) end |
#map_list(states = SUCCESS) {|ListOfNodes.new(pgt)| ... } ⇒ Object
21 22 23 24 25 |
# File 'lib/hydrangea/flow.rb', line 21 def map_list(states = SUCCESS) pgt = PartialGraphTransform.new(@graph, states) yield ListOfNodes.new(pgt) self.class.new(pgt.finish) end |
#map_values(states = SUCCESS) {|NodesByValue.new(pgt)| ... } ⇒ Object
27 28 29 30 31 |
# File 'lib/hydrangea/flow.rb', line 27 def map_values(states = SUCCESS) pgt = PartialGraphTransform.new(@graph, states) yield NodesByValue.new(pgt) self.class.new(pgt.finish) end |
#sink(states = SUCCESS) ⇒ Object
33 34 35 |
# File 'lib/hydrangea/flow.rb', line 33 def sink(states = SUCCESS) GraphPartition[states].select(@graph) end |