Class: Aireview::CandidateChecker::Section

Inherits:
Struct
  • Object
show all
Defined in:
lib/aireview/candidate_checker.rb

Overview

One file of the context: the new-file line ranges of the shown hunks and the normalized text of every hunk for the quote search — the new side (context + added lines) and the old side (context + removed lines) separately, so that a multi-line quote from one version of the file is found whole. Hunks are not glued together: there is skipped code between them, and a quote across a hunk boundary is not a quote.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hunks ⇒ Object

Returns the value of attribute hunks

Returns:

  • (Object) —

    the current value of hunks



25
26
27
# File 'lib/aireview/candidate_checker.rb', line 25

def hunks
  @hunks
end

#partial ⇒ Object

Returns the value of attribute partial

Returns:

  • (Object) —

    the current value of partial



25
26
27
# File 'lib/aireview/candidate_checker.rb', line 25

def partial
  @partial
end

#ranges ⇒ Object

Returns the value of attribute ranges

Returns:

  • (Object) —

    the current value of ranges



25
26
27
# File 'lib/aireview/candidate_checker.rb', line 25

def ranges
  @ranges
end

Instance Method Details

#include?(quote) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/aireview/candidate_checker.rb', line 26

def include?(quote)
  hunks.any? { |hunk| hunk[:new_text].include?(quote) || hunk[:old_text].include?(quote) }
end