method
build_path
v6.0.0 -
Show latest stable
-
0 notes -
Class: ActionDispatch::Routing::Mapper::Mapping
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1 (0)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
build_path(ast, requirements, anchor)
private
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