class Utils::Patterns::FuzzyPattern

def initialize(opts = {})

Options Hash: (**opts)
  • :pattern (String) -- the pattern string to be used for matching
  • :icase (TrueClass, FalseClass) -- whether the pattern matching should be case sensitive
  • :cset (String) -- the character set to filter pattern characters against

Parameters:
  • opts (Hash) -- a hash containing the pattern configuration options
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