Sha256: 1677d0fd737744426bf37f2714c7cff6a5445bb6dbe87304750ba3256290250e
Contents?: true
Size: 844 Bytes
Versions: 1
Compression:
Stored size: 844 Bytes
Contents
# frozen_string_literal: true module Wayfarer module Routing class Route include DSL attr_reader :children attr_accessor :matcher, :parent, :action, :path_offset 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wayfarer-0.4.1 | lib/wayfarer/routing/route.rb |