method

build_path

Importance_0
v6.0.0 - Show latest stable - 0 notes - Class: ActionDispatch::Routing::Mapper::Mapping
build_path(ast, requirements, anchor) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 196 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
Register or log in to add new notes.