Class: QuietQuality::AnnotationLocator

Inherits:
Object
  • Object
show all
Defined in:
lib/quiet_quality/annotation_locator.rb

Instance Method Summary collapse

Constructor Details

#initialize(changed_files:) ⇒ AnnotationLocator

Returns a new instance of AnnotationLocator.



3
4
5
# File 'lib/quiet_quality/annotation_locator.rb', line 3

def initialize(changed_files:)
  @changed_files = changed_files
end

Instance Method Details

#update!(message) ⇒ Object



7
8
9
10
# File 'lib/quiet_quality/annotation_locator.rb', line 7

def update!(message)
  changed_file = changed_files.file(message.path)
  message.annotated_line = changed_file ? file_line_for(message, changed_file) : nil
end

#update_all!(messages) ⇒ Object



12
13
14
# File 'lib/quiet_quality/annotation_locator.rb', line 12

def update_all!(messages)
  messages.map { |m| update!(m) }.compact.length
end