Class: Regex::MatchOption

Inherits:
Object
  • Object
show all
Defined in:
lib/regex/match_option.rb

Overview

Represents an option that influences the way a regular (sub)expression can perform its matching.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theName, theSetting) ⇒ MatchOption

Constructor.



14
15
16
17
# File 'lib/regex/match_option.rb', line 14

def initialize(theName, theSetting)
  @name = theName
  @setting = theSetting
end

Instance Attribute Details

#nameObject (readonly)

The symbolic name of the option



8
9
10
# File 'lib/regex/match_option.rb', line 8

def name
  @name
end

#settingObject (readonly)

An indicator that tells whether the option is turned on or off



11
12
13
# File 'lib/regex/match_option.rb', line 11

def setting
  @setting
end

Instance Method Details

#==(other) ⇒ Object

Equality operator



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/regex/match_option.rb', line 20

def ==(other)
  return true if object_id == other.object_id

  if other.kind_of?(MatchOption)
    isEqual = ((name == other.name) && (setting == other.setting))
  else
    isEqual = false
  end

  return isEqual
end