method

requirements_anchored?

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Pattern
requirements_anchored?() public

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/journey/path/pattern.rb, line 34
        def requirements_anchored?
          # each required param must not be surrounded by a literal, otherwise it isn't simple to chunk-match the url piecemeal
          terminals = ast.terminals

          terminals.each_with_index { |s, index|
            next if index < 1
            next if s.type == :DOT || s.type == :SLASH

            back = terminals[index - 1]
            fwd = terminals[index + 1]

            # we also don't support this yet, constraints must be regexps
            return false if s.symbol? && s.regexp.is_a?(Array)

            return false if back.literal?
            return false if !fwd.nil? && fwd.literal?
          }

          true
        end
Register or log in to add new notes.