Class: LibRubyParser::SourceLine
- Inherits:
-
Object
- Object
- LibRubyParser::SourceLine
- Defined in:
- lib/lib-ruby-parser.rb
Overview
Representation of a source line in a source file
Instance Attribute Summary collapse
-
#end ⇒ Integer
End of the line (in bytes).
-
#ends_with_eof ⇒ true, false
+true+ if line ends with EOF char (which is true for the last line in the file).
-
#start ⇒ Integer
Start of the line (in bytes).
Instance Method Summary collapse
-
#==(other) ⇒ Object
Default +==+ comparison.
-
#initialize(**options) ⇒ SourceLine
constructor
A new instance of SourceLine.
Constructor Details
#initialize(**options) ⇒ SourceLine
Returns a new instance of SourceLine.
215 216 217 218 219 |
# File 'lib/lib-ruby-parser.rb', line 215 def initialize(**) @start = [:start] @end = [:end] @ends_with_eof = [:ends_with_eof] end |
Instance Attribute Details
#end ⇒ Integer
End of the line (in bytes)
204 205 206 |
# File 'lib/lib-ruby-parser.rb', line 204 def end @end end |
#ends_with_eof ⇒ true, false
+true+ if line ends with EOF char (which is true for the last line in the file)
209 210 211 |
# File 'lib/lib-ruby-parser.rb', line 209 def ends_with_eof @ends_with_eof end |
#start ⇒ Integer
Start of the line (in bytes)
199 200 201 |
# File 'lib/lib-ruby-parser.rb', line 199 def start @start end |
Instance Method Details
#==(other) ⇒ Object
Default +==+ comparison
222 223 224 225 226 |
# File 'lib/lib-ruby-parser.rb', line 222 def ==(other) start == other.start && self.end == other.end && ends_with_eof == other.ends_with_eof end |