Module: MARS::Rendering::Graph::Gate

Includes:
Base
Defined in:
lib/mars/rendering/graph/gate.rb

Instance Method Summary collapse

Methods included from Base

#build_graph, #node_id

Instance Method Details

#to_graph(builder, parent_id: nil, value: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/mars/rendering/graph/gate.rb', line 9

def to_graph(builder, parent_id: nil, value: nil)
  builder.add_node(node_id, name, Node::GATE)
  builder.add_edge(parent_id, node_id, value)

  sink_nodes = fallbacks.map do |fallback_key, branch|
    branch.to_graph(builder, parent_id: node_id, value: fallback_key)
  end

  sink_nodes.flatten
end