Module: HTMLProofer::Utils
- Included in:
- Attribute, Cache, Check, Element, Reporter, Runner, UrlValidator, HTMLProofer::UrlValidator::External
- Defined in:
- lib/html_proofer/utils.rb
Instance Method Summary collapse
Instance Method Details
#blank?(obj) ⇒ Boolean
11 12 13 |
# File 'lib/html_proofer/utils.rb', line 11 def blank?(obj) obj.nil? || obj.empty? end |
#create_nokogiri(path) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# 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) ⇒ Object
7 8 9 |
# File 'lib/html_proofer/utils.rb', line 7 def pluralize(count, single, plural) "#{count} #{count == 1 ? single : plural}" end |