module HTMLProofer::Utils

Public Instance Methods

blank?(obj) click to toggle source
# File lib/html_proofer/utils.rb, line 11
def blank?(obj)
  obj.nil? || obj.empty?
end
create_nokogiri(path) click to toggle source
# File lib/html_proofer/utils.rb, line 15
def create_nokogiri(path)
  content = if File.exist?(path) && !File.directory?(path)
    File.read(path)
  else
    path
  end

  Nokogiri::HTML5(content, max_errors: -1)
end
pluralize(count, single, plural) click to toggle source
# File lib/html_proofer/utils.rb, line 7
def pluralize(count, single, plural)
  "#{count} #{count == 1 ? single : plural}"
end