Class: Kleene::MatchRef
- Inherits:
-
Object
- Object
- Kleene::MatchRef
- Defined in:
- lib/kleene/kleene.rb
Instance Attribute Summary collapse
-
#range ⇒ Object
: Range(Int32, Int32).
-
#string ⇒ Object
: String.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(original_string, match_range) ⇒ MatchRef
constructor
A new instance of MatchRef.
- #text ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(original_string, match_range) ⇒ MatchRef
Returns a new instance of MatchRef.
65 66 67 68 |
# File 'lib/kleene/kleene.rb', line 65 def initialize(original_string, match_range) @string = original_string @range = match_range end |
Instance Attribute Details
#range ⇒ Object
: Range(Int32, Int32)
63 64 65 |
# File 'lib/kleene/kleene.rb', line 63 def range @range end |
#string ⇒ Object
: String
62 63 64 |
# File 'lib/kleene/kleene.rb', line 62 def string @string end |
Instance Method Details
#==(other) ⇒ Object
78 79 80 81 |
# File 'lib/kleene/kleene.rb', line 78 def ==(other) @string == other.string && @range == other.range end |
#eql?(other) ⇒ Boolean
83 84 85 |
# File 'lib/kleene/kleene.rb', line 83 def eql?(other) self == other end |
#text ⇒ Object
70 71 72 |
# File 'lib/kleene/kleene.rb', line 70 def text @string[@range] end |
#to_s ⇒ Object
74 75 76 |
# File 'lib/kleene/kleene.rb', line 74 def to_s text end |