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.
64 65 66 67 |
# File 'lib/kleene/kleene.rb', line 64 def initialize(original_string, match_range) @string = original_string @range = match_range end |
Instance Attribute Details
#range ⇒ Object
: Range(Int32, Int32)
62 63 64 |
# File 'lib/kleene/kleene.rb', line 62 def range @range end |
#string ⇒ Object
: String
61 62 63 |
# File 'lib/kleene/kleene.rb', line 61 def string @string end |
Instance Method Details
#==(other) ⇒ Object
77 78 79 |
# File 'lib/kleene/kleene.rb', line 77 def ==(other) @string == other.string && @range == other.range end |
#eql?(other) ⇒ Boolean
81 82 83 |
# File 'lib/kleene/kleene.rb', line 81 def eql?(other) self == other end |
#text ⇒ Object
69 70 71 |
# File 'lib/kleene/kleene.rb', line 69 def text @string[@range] end |
#to_s ⇒ Object
73 74 75 |
# File 'lib/kleene/kleene.rb', line 73 def to_s text end |