Class: Utils::Patterns::FuzzyPattern
- Defined in:
- lib/utils/patterns.rb
Instance Attribute Summary
Attributes inherited from Pattern
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ FuzzyPattern
constructor
A new instance of FuzzyPattern.
Methods inherited from Pattern
Constructor Details
#initialize(opts = {}) ⇒ FuzzyPattern
Returns a new instance of FuzzyPattern.
22 23 24 25 26 27 28 29 30 |
# File 'lib/utils/patterns.rb', line 22 def initialize(opts = {}) super r = @pattern.split(//).grep(/[[:print:]]/).map { |x| "(#{Regexp.quote(x)})" } * '.*?' @matcher = Regexp.new( "\\A(?:.*/.*?#{r}|.*#{r})", @icase ? Regexp::IGNORECASE : 0) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Utils::Patterns::Pattern