class ActionDispatch::Routing::Mapper::Mapping

def build_path(ast, requirements, anchor)

def build_path(ast, requirements, anchor)
  pattern = Journey::Path::Pattern.new(ast, requirements, JOINED_SEPARATORS, anchor)
  # Find all the symbol nodes that are adjacent to literal nodes and alter
  # the regexp so that Journey will partition them into custom routes.
  ast.find_all { |node|
    next unless node.cat?
    if node.left.literal? && node.right.symbol?
      symbol = node.right
    elsif node.left.literal? && node.right.cat? && node.right.left.symbol?
      symbol = node.right.left
    elsif node.left.symbol? && node.right.literal?
      symbol = node.left
    elsif node.left.symbol? && node.right.cat? && node.right.left.literal?
      symbol = node.left
    else
      next
    end
    if symbol
      symbol.regexp = /(?:#{Regexp.union(symbol.regexp, '-')})+/
    end
  }
  pattern
end