Module: Roda::RodaPlugins::Base::RequestClassMethods
- Defined in:
- lib/roda/request.rb
Overview
Class methods for RodaRequest
Instance Attribute Summary collapse
-
#match_pattern_cache ⇒ Object
The cache to use for match patterns for this request class.
-
#roda_class ⇒ Object
Reference to the Roda class related to this request class.
Instance Method Summary collapse
-
#cached_matcher(obj) ⇒ Object
Return the cached pattern for the given object.
-
#inspect ⇒ Object
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.
Instance Attribute Details
#match_pattern_cache ⇒ Object
The cache to use for match patterns for this request class.
36 37 38 |
# File 'lib/roda/request.rb', line 36 def match_pattern_cache @match_pattern_cache end |
#roda_class ⇒ Object
Reference to the Roda class related to this request class.
33 34 35 |
# File 'lib/roda/request.rb', line 33 def roda_class @roda_class end |
Instance Method Details
#cached_matcher(obj) ⇒ Object
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.
41 42 43 44 45 46 47 48 49 |
# File 'lib/roda/request.rb', line 41 def cached_matcher(obj) cache = @match_pattern_cache unless pattern = cache[obj] pattern = cache[obj] = consume_pattern(yield) end pattern end |
#inspect ⇒ Object
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.
54 55 56 |
# File 'lib/roda/request.rb', line 54 def inspect "#{roda_class.inspect}::RodaRequest" end |