class Pedant::CheckEndsWithNewline

Public Class Methods

requires() click to toggle source
Calls superclass method Pedant::Check::requires
# File lib/pedant/checks/ends_with_newline.rb, line 29
def self.requires
  super + [:codes]
end

Public Instance Methods

check(file, code) click to toggle source
# File lib/pedant/checks/ends_with_newline.rb, line 33
def check(file, code)
  return if code[-1] == "\n"

  warn

  report(:warn, "#{file} does not end with a newline.")
end
run() click to toggle source
# File lib/pedant/checks/ends_with_newline.rb, line 41
def run
  # This check will pass by default.
  pass

  # Run this check on the code in every file.
  @kb[:codes].each { |file, code| check(file, code) }
end