Sha256: 16beefde1a67d9dd089469dfc4a58a7fe1ece6facf077c2de32d73ad76cee31b
Contents?: true
Size: 976 Bytes
Versions: 5
Compression:
Stored size: 976 Bytes
Contents
# frozen_string_literal: true module Wayfarer module Routing class Route include DSL include Stringify attr_reader :children attr_accessor :matcher, :parent, :action, :path_offset stringify :matcher, :action, :path_offset, :children def initialize(matcher = Matchers::Custom.new { children.any? }, path_offset = "/") @matcher = matcher @children = [] @path_offset = path_offset end def match(url) matcher.match(url) end def matches?(url) invoke(url).is_a?(Result::Match) end def invoke(url) PathFinder.result(self, url) end # Accepts a visitor for in-order traversal. def accept(visitor) return unless visitor.visit(self) children.each { |child| child.accept(visitor) } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems