class ActionDispatch::Journey::Path::Pattern::AnchoredRegexp
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/action_dispatch/journey/path/pattern.rbs class ActionDispatch::Journey::Path::Pattern::AnchoredRegexp < ActionDispatch::Journey::Path::Pattern::Journey::Visitors::Visitor def visit_CAT: (ActionDispatch::Journey::Nodes::Cat node) -> String end
:nodoc:
def accept(node)
def accept(node) %r{\A#{visit node}\Z} end
def initialize(separator, matchers)
def initialize(separator, matchers) @separator = separator @matchers = matchers @separator_re = "([^#{separator}]+)" super() end
def visit_CAT(node)
Experimental RBS support (using type sampling data from the type_fusion
project).
def visit_CAT: (ActionDispatch::Journey::Nodes::Cat node) -> String
This signature was generated using 1 sample from 1 application.
def visit_CAT(node) "#{visit(node.left)}#{visit(node.right)}" end
def visit_GROUP(node)
def visit_GROUP(node) "(?:#{visit node.left})?" end
def visit_LITERAL(node)
def visit_LITERAL(node) Regexp.escape(node.left) end
def visit_OR(node)
def visit_OR(node) children = node.children.map { |n| visit n } "(?:#{children.join(?|)})" end
def visit_SLASH(node)
def visit_SLASH(node) node.left end
def visit_STAR(node)
def visit_STAR(node) re = @matchers[node.left.to_sym] re ? "(#{re})" : "(.+)" end
def visit_SYMBOL(node)
def visit_SYMBOL(node) node = node.to_sym return @separator_re unless @matchers.key?(node) re = @matchers[node] "(#{Regexp.union(re)})" end