class Goodcheck::Issue

Attributes

buffer[R]
range[R]
rule[R]
text[R]

Public Class Methods

new(buffer:, rule:, text: nil, text_begin_pos: nil) click to toggle source
# File lib/goodcheck/issue.rb, line 8
def initialize(buffer:, rule:, text: nil, text_begin_pos: nil)
  @buffer = buffer
  @rule = rule
  @text = text
  @range = text ? text_begin_pos..(text_begin_pos + text.bytesize - 1) : nil
  @location = nil
end

Public Instance Methods

==(other) click to toggle source
# File lib/goodcheck/issue.rb, line 32
def ==(other)
  other.is_a?(Issue) &&
    other.buffer == buffer &&
    other.range == range &&
    other.rule == rule
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/goodcheck/issue.rb, line 41
def hash
  self.class.hash ^ buffer.hash ^ range.hash ^ rule.hash
end
location() click to toggle source
# File lib/goodcheck/issue.rb, line 20
def location
  if range
    unless @location
      start_line, start_column = buffer.location_for_position(range.begin)
      end_line, end_column = buffer.location_for_position(range.end)
      @location = Location.new(start_line: start_line, start_column: start_column, end_line: end_line, end_column: end_column)
    end

    @location
  end
end
path() click to toggle source
# File lib/goodcheck/issue.rb, line 16
def path
  buffer.path
end