module Roda::RodaPlugins::Base::RequestClassMethods
Class methods for RodaRequest
Attributes
The cache to use for match patterns for this request class.
Reference to the Roda
class related to this request class.
Public Instance Methods
Source
# File lib/roda/request.rb, line 39 def cached_matcher(obj) cache = @match_pattern_cache unless pattern = cache[obj] pattern = cache[obj] = consume_pattern(yield) end pattern end
Return the cached pattern for the given object. If the object is not already cached, yield to get the basic pattern, and convert the basic pattern to a pattern that does not match partial segments.
Source
# File lib/roda/request.rb, line 52 def inspect "#{roda_class.inspect}::RodaRequest" end
Since RodaRequest
is anonymously subclassed when Roda
is subclassed, and then assigned to a constant of the Roda
subclass, make inspect reflect the likely name for the class.
Private Instance Methods
Source
# File lib/roda/request.rb, line 61 def consume_pattern(pattern) /\A\/(?:#{pattern})(?=\/|\z)/ end
The pattern to use for consuming, based on the given argument. The returned pattern requires the path starts with a string and does not match partial segments.