class Regex::MatchOption

Represents a set of options that influences the way a regular (sub)expression can perform its matching.

Attributes

flags[R]

@return [Array] Array of Regexp flags

Public Class Methods

new(theChild, theFlags) click to toggle source

Constructor. @param theChild [Regex::Expression] Child expression on which options apply. @param theFlags [Array] An array of Regexp options

Calls superclass method
# File lib/regex/match_option.rb, line 17
def initialize(theChild, theFlags)
  super(theChild)
  @flags = theFlags
end

Public Instance Methods

==(other) click to toggle source

Equality operator @param other [Regex::MatchOption]

# File lib/regex/match_option.rb, line 34
def ==(other)
  return true if object_id == other.object_id

  if other.kind_of?(MatchOption)
    isEqual = ((flags == other.flags) && (child == other.child))
  else
    isEqual = false
  end

  return isEqual
end
combine_opts() click to toggle source

Combine all options/flags into one integer value that is compliant as second argument of with Regexp#new method. return [Integer]

# File lib/regex/match_option.rb, line 25
def combine_opts
  result = 0
  flags.each { |f| result |= f }

  return result
end

Protected Instance Methods

text_repr() click to toggle source

Conversion method re-definition. Purpose: Return the String representation of the concatented expressions.

# File lib/regex/match_option.rb, line 50
def text_repr
  all_child_text
end