Class: Mailman::Route::RegexpMatcher
- Defined in:
- lib/mailman/route/regexp_matcher.rb
Overview
Matches using a Regexp
.
Instance Attribute Summary
Attributes inherited from Matcher
Class Method Summary collapse
Instance Method Summary collapse
-
#match(string) ⇒ ({:captures => <String>}, <String>)
Matches against a string using the stored
Regexp
.
Methods inherited from Matcher
#compile!, create, inherited, #initialize
Constructor Details
This class inherits a constructor from Mailman::Route::Matcher
Class Method Details
.valid_pattern?(pattern) ⇒ Boolean
17 18 19 |
# File 'lib/mailman/route/regexp_matcher.rb', line 17 def self.valid_pattern?(pattern) pattern.class == Regexp end |
Instance Method Details
#match(string) ⇒ ({:captures => <String>}, <String>)
Matches against a string using the stored Regexp
.
10 11 12 13 14 15 |
# File 'lib/mailman/route/regexp_matcher.rb', line 10 def match(string) if match = @pattern.match(string) captures = match.captures [{:captures => captures}, captures] end end |