Class: Knot::Dispatch::Path
- Inherits:
-
Object
- Object
- Knot::Dispatch::Path
- Defined in:
- lib/knot/dispatch/path.rb
Class Method Summary collapse
Class Method Details
.match?(subject, other) ⇒ Boolean
5 6 7 8 9 10 |
# File 'lib/knot/dispatch/path.rb', line 5 def self.match?(subject, other) return false if chunks(subject).length != chunks(other).length pairs(subject, other).all? do |subject_chunk, other_chunk| variable?(subject_chunk) || subject_chunk == other_chunk end end |
.path_params(subject, request) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/knot/dispatch/path.rb', line 12 def self.path_params(subject, request) url_params = pairs(subject, request.path).inject({}) do |hash, values| key, value = values hash[symbolize(key)] = value if variable?(key) hash end end |