Class: Goodcheck::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/goodcheck/issue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buffer:, range:, rule:, text:) ⇒ Issue

Returns a new instance of Issue.



8
9
10
11
12
13
# File 'lib/goodcheck/issue.rb', line 8

def initialize(buffer:, range:, rule:, text:)
  @buffer = buffer
  @range = range
  @rule = rule
  @text = text
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



3
4
5
# File 'lib/goodcheck/issue.rb', line 3

def buffer
  @buffer
end

#rangeObject (readonly)

Returns the value of attribute range.



4
5
6
# File 'lib/goodcheck/issue.rb', line 4

def range
  @range
end

#ruleObject (readonly)

Returns the value of attribute rule.



5
6
7
# File 'lib/goodcheck/issue.rb', line 5

def rule
  @rule
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/goodcheck/issue.rb', line 6

def text
  @text
end

Instance Method Details

#locationObject



19
20
21
22
23
24
25
26
27
# File 'lib/goodcheck/issue.rb', line 19

def location
  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

#pathObject



15
16
17
# File 'lib/goodcheck/issue.rb', line 15

def path
  buffer.path
end