class Goodcheck::Location
In the example below, each attribute is:
-
start_line
: 2 -
start_column
: 3 -
end_line
: 2 -
end_column
: 9
@example
1 | 2 | A matched text 3 | ^~~~~~~ 3456789
Attributes
end_column[R]
end_line[R]
start_column[R]
start_line[R]
Public Class Methods
new(start_line:, start_column:, end_line:, end_column:)
click to toggle source
# File lib/goodcheck/location.rb, line 22 def initialize(start_line:, start_column:, end_line:, end_column:) @start_line = start_line @start_column = start_column @end_line = end_line @end_column = end_column end
Public Instance Methods
==(other)
click to toggle source
# File lib/goodcheck/location.rb, line 37 def ==(other) other.is_a?(Location) && other.start_line == start_line && other.start_column == start_column && other.end_line == end_line && other.end_column == end_column end
Also aliased as: eql?
column_size()
click to toggle source
# File lib/goodcheck/location.rb, line 33 def column_size end_column - start_column + 1 end
hash()
click to toggle source
# File lib/goodcheck/location.rb, line 47 def hash self.class.hash ^ start_line.hash ^ start_column.hash ^ end_line.hash ^ end_column.hash end
one_line?()
click to toggle source
# File lib/goodcheck/location.rb, line 29 def one_line? start_line == end_line end