Class: Mailman::Route::RegexpMatcher
- Inherits:
-
Matcher
- Object
- Matcher
- 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)
-
- (({:captures => <String>}, <String>)) match(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
+ (Boolean) valid_pattern?(pattern)
17 18 19 |
# File 'lib/mailman/route/regexp_matcher.rb', line 17 def self.valid_pattern?(pattern) pattern.class == Regexp end |
Instance Method Details
- (({:captures => <String>}, <String>)) match(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 |