Class: Utils::Patterns::RegexpPattern

Inherits:
Pattern show all
Defined in:
lib/utils/patterns.rb

Instance Attribute Summary

Attributes inherited from Pattern

#matcher

Instance Method Summary collapse

Methods inherited from Pattern

#method_missing

Constructor Details

#initialize(opts = {}) ⇒ Regexp

Initializes a regular expression pattern matcher with the specified options.

This method sets up a regular expression object based on the pattern string and case sensitivity configuration that was previously initialized in the parent class. It compiles the pattern into a Regexp object that can be used for matching operations throughout the pattern matching process.

Parameters:

  • opts (Hash) (defaults to: {})

    a hash containing the pattern configuration options

Options Hash (opts):

  • :cset (String)

    the character set to filter pattern characters against

  • :icase (TrueClass, FalseClass)

    whether the pattern matching should be case sensitive

  • :pattern (String)

    the pattern string to be used for matching



89
90
91
92
93
94
# File 'lib/utils/patterns.rb', line 89

def initialize(opts = {})
  super
  @matcher = Regexp.new(
    @pattern, @icase ? Regexp::IGNORECASE : 0
  )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Utils::Patterns::Pattern