Class: Wayfarer::Routing::Matchers::Path
- Inherits:
-
Object
- Object
- Wayfarer::Routing::Matchers::Path
- Defined in:
- lib/wayfarer/routing/matchers/path.rb
Constant Summary collapse
- PATTERN_TYPE =
"sinatra"
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
- #evaluate(path_finder) ⇒ Object
-
#initialize(pattern) ⇒ Path
constructor
A new instance of Path.
- #params(path_finder) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(pattern) ⇒ Path
Returns a new instance of Path.
11 12 13 |
# File 'lib/wayfarer/routing/matchers/path.rb', line 11 def initialize(pattern) @pattern = Mustermann.new(pattern, type: PATTERN_TYPE) end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
9 10 11 |
# File 'lib/wayfarer/routing/matchers/path.rb', line 9 def pattern @pattern end |
Instance Method Details
#evaluate(path_finder) ⇒ Object
15 16 17 |
# File 'lib/wayfarer/routing/matchers/path.rb', line 15 def evaluate(path_finder) path_finder.path_consumer.current_state.valid? end |
#params(path_finder) ⇒ Object
19 20 21 |
# File 'lib/wayfarer/routing/matchers/path.rb', line 19 def params(path_finder) path_finder.path_consumer.current_state.params end |
#to_h ⇒ Object
23 24 25 |
# File 'lib/wayfarer/routing/matchers/path.rb', line 23 def to_h { pattern: pattern.to_s } end |