Class: HTMLProofer::Check::MailtoAwesome
- Inherits:
-
HTMLProofer::Check
- Object
- HTMLProofer::Check
- HTMLProofer::Check::MailtoAwesome
- Defined in:
- lib/mailto_awesome.rb
Instance Method Summary collapse
Instance Method Details
#awesome? ⇒ Boolean
13 14 15 |
# File 'lib/mailto_awesome.rb', line 13 def awesome? @link.href.downcase.include?('subject=') && @link.href.downcase.include?('body=') end |
#mailto? ⇒ Boolean
8 9 10 11 |
# File 'lib/mailto_awesome.rb', line 8 def mailto? return false if @link.ignore? || @link.href.nil? @link.href.match(/^mailto:/i) end |
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mailto_awesome.rb', line 17 def run # Check if the mailto awesome check is enabled via runner options return unless @runner && @runner.instance_variable_get('@options')&.fetch(:check_mailto_awesome, false) @html.css('a').each do |node| @link = create_element(node) if mailto? && !awesome? add_failure("This is a not-awesome mailto link!", element: @link) end end end |