class Object

Constants

DEFAULT_CONFIGURATION
DEFAULT_IGNORES
DEFAULT_RULES

Note that order is significant; Only the earliest file pattern match’s rule applies.

DNE
MAC_OS_X
MIME_FLAG
NO_SUCH_FILE

Warning for files that do not exist

PARSER

Public Class Methods

check(filename, configuration = nil) click to toggle source
# File lib/enlint.rb, line 149
def self.check(filename, configuration = nil)
  configuration =
    if configuration.nil?
      DEFAULT_CONFIGURATION
    else
      DEFAULT_CONFIGURATION.merge(YAML.load(configuration))
    end

  rules = configuration['rules']

  line = `file #{MIME_FLAG} "#{filename}" 2>&1`

  encoding = AnEncoding.parse(filename, line)

  encoding_difference = encoding.violate?(rules)

  puts encoding.to_s(encoding_difference) if encoding_difference
end