Class: Kawaii::RegexpMatcher
- Inherits:
-
Object
- Object
- Kawaii::RegexpMatcher
- Defined in:
- lib/kawaii/matchers.rb
Overview
Regular expression matcher.
Instance Method Summary (collapse)
-
- (RegexpMatcher) initialize(rx)
constructor
Creates a RegexpMatcher.
-
- (Match) match(path)
Tries to match the actual path.
Constructor Details
- (RegexpMatcher) initialize(rx)
TODO:
Support parameters based on named capture groups.
Creates a Kawaii::RegexpMatcher
105 106 107 |
# File 'lib/kawaii/matchers.rb', line 105 def initialize(rx) @rx = rx end |
Instance Method Details
- (Match) match(path)
Tries to match the actual path. no match.
113 114 115 116 |
# File 'lib/kawaii/matchers.rb', line 113 def match(path) new_path = path.gsub(@rx, '') Match.new(new_path) if path != new_path end |