Class: Pronto::Punchlist::PatchValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/pronto/punchlist/patch_validator.rb

Overview

Determine if a patch contains analyzable files

Instance Method Summary collapse

Constructor Details

#initialize(file_classifier: FileClassifier.new) ⇒ PatchValidator

Returns a new instance of PatchValidator.



10
11
12
# File 'lib/pronto/punchlist/patch_validator.rb', line 10

def initialize(file_classifier: FileClassifier.new)
  @file_classifier = file_classifier
end

Instance Method Details

#valid_patch?(patch) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/pronto/punchlist/patch_validator.rb', line 14

def valid_patch?(patch)
  return false if patch.additions < 1

  path = patch.new_file_full_path

  @file_classifier.non_binary?(path)
end