Class: Pronto::XMLLintRunner

Inherits:
Runner
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pronto/xmllint_runner.rb

Constant Summary collapse

EXTENSION =
/^\..*xml$/

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.checkable?(path) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/pronto/xmllint_runner.rb', line 21

def checkable?(path)
  path_has_extension?(path)
end

.path_has_extension?(path) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/pronto/xmllint_runner.rb', line 25

def path_has_extension?(path)
  !(EXTENSION =~ path.extname).nil?
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
# File 'lib/pronto/xmllint_runner.rb', line 12

def run
  return [] if !@patches || @patches.count.zero?

  @patches
    .select { |patch| patch.additions > 0 && checkable?(patch.new_file_full_path) }
    .reduce([]) { |results, patch| results.concat(inspect(patch)) }
end