module HTMLProofer::Utils
Public Instance Methods
create_nokogiri(path)
click to toggle source
# File lib/html-proofer/utils.rb, line 11 def create_nokogiri(path) content = if File.exist?(path) && !File.directory?(path) File.open(path).read 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
swap(href, replacement)
click to toggle source
# File lib/html-proofer/utils.rb, line 21 def swap(href, replacement) replacement.each do |link, replace| href = href.gsub(link, replace) end href end