123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Journey::Visitors::Dot

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActionDispatch::Journey::Visitors::FunctionalVisitor
Defined in: actionpack/lib/action_dispatch/journey/visitors.rb

Constant Summary

FunctionalVisitor - Inherited

DISPATCH_CACHE

Class Method Summary

Instance Method Summary

Constructor Details

.newDot

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 197

def initialize
  @nodes = []
  @edges = []
end

Instance Method Details

#accept(node, seed = [[], []])

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 202

def accept(node, seed = [[], []])
  super
  nodes, edges = seed
  <<-eodot
  digraph parse_tree {
    size="8,5"
    node [shape = none];
    edge [dir = none];
    #{nodes.join "\n"}
    #{edges.join("\n")}
  }
  eodot
end

#binary(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 217

def binary(node, seed)
  seed.last.concat node.children.map { |c|
    "#{node.object_id} -> #{c.object_id};"
  }
  super
end

#nary(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 224

def nary(node, seed)
  seed.last.concat node.children.map { |c|
    "#{node.object_id} -> #{c.object_id};"
  }
  super
end

#terminal(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 256

def terminal(node, seed)
  value = node.left

  seed.first << "#{node.object_id} [label=\"#{value}\"];"
  seed
end

#unary(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 231

def unary(node, seed)
  seed.last << "#{node.object_id} -> #{node.left.object_id};"
  super
end

#visit_CAT(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 241

def visit_CAT(node, seed)
  seed.first << "#{node.object_id} [label=\"○\"];"
  super
end

#visit_GROUP(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 236

def visit_GROUP(node, seed)
  seed.first << "#{node.object_id} [label=\"()\"];"
  super
end

#visit_OR(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 251

def visit_OR(node, seed)
  seed.first << "#{node.object_id} [label=\"|\"];"
  super
end

#visit_STAR(node, seed) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/journey/visitors.rb', line 246

def visit_STAR(node, seed)
  seed.first << "#{node.object_id} [label=\"*\"];"
  super
end