Class: Kawaii::StringMatcher
- Inherits:
-
Object
- Object
- Kawaii::StringMatcher
- Defined in:
- lib/kawaii/matchers.rb
Overview
Matcher for string paths. Supports named params.
Instance Method Summary (collapse)
-
- (StringMatcher) initialize(path)
constructor
Creates a StringMatcher.
-
- (Match) match(path)
Tries to match the actual path.
Constructor Details
- (StringMatcher) initialize(path)
Creates a Kawaii::StringMatcher
67 68 69 |
# File 'lib/kawaii/matchers.rb', line 67 def initialize(path) @rx = compile(path) end |
Instance Method Details
- (Match) match(path)
Tries to match the actual path. is no match.
75 76 77 78 |
# File 'lib/kawaii/matchers.rb', line 75 def match(path) m = path.match(@rx) Match.new(remaining_path(path, m), match_to_params(m)) if m end |