123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Journey::Visitors::String

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: actionpack/lib/action_dispatch/journey/visitors.rb

Constant Summary

Instance Method Summary

Instance Method Details

#accept(node, seed)

[ GitHub ]

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

def accept(node, seed)
  case node.type
  when :DOT
    seed << node.left
  when :LITERAL
    seed << node.left
  when :SYMBOL
    seed << node.left
  when :SLASH
    seed << node.left
  when :CAT
    accept(node.right, accept(node.left, seed))
  when :STAR
    accept(node.left, seed)
  when :OR
    last_child = node.children.last
    node.children.each do |c|
      accept(c, seed)
      seed << "|" unless last_child == c
    end
    seed
  when :GROUP
    accept(node.left, seed << "(") << ")"
  else
    raise "Unknown node type: #{node.type}"
  end
end