Class: Mustermann::Set::Match
- Inherits:
-
Match
- Object
- Match
- Mustermann::Set::Match
- Defined in:
- mustermann/lib/mustermann/set/match.rb
Overview
Subclass of Match that also includes the value associated with the pattern that produced the match.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
The value associated with the pattern that produced the match, if any.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
-
#initialize(value: nil) ⇒ Match
constructor
A new instance of Match.
Constructor Details
#initialize(pattern, string, **options) ⇒ Match #initialize(match, **options) ⇒ Match #initialize(pattern, match, **options) ⇒ Match
Returns a new instance of Match.
14 15 16 17 |
# File 'mustermann/lib/mustermann/set/match.rb', line 14 def initialize(*, value: nil, **) @value = value super(*, **) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value associated with the pattern that produced the match, if any.
10 11 12 |
# File 'mustermann/lib/mustermann/set/match.rb', line 10 def value @value end |
Instance Method Details
#eql?(other) ⇒ Boolean
20 |
# File 'mustermann/lib/mustermann/set/match.rb', line 20 def eql?(other) = super && value == other.value |