Class: Blinkr::Extensions::EmptyAHref
- Inherits:
-
Object
- Object
- Blinkr::Extensions::EmptyAHref
- Defined in:
- lib/blinkr/extensions/empty_a_href.rb
Instance Method Summary collapse
- #collect(page) ⇒ Object
-
#initialize(config) ⇒ EmptyAHref
constructor
A new instance of EmptyAHref.
Constructor Details
#initialize(config) ⇒ EmptyAHref
Returns a new instance of EmptyAHref.
5 6 7 |
# File 'lib/blinkr/extensions/empty_a_href.rb', line 5 def initialize config @config = config end |
Instance Method Details
#collect(page) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/blinkr/extensions/empty_a_href.rb', line 9 def collect page page.body.css('a[href]').each do |a| if a['href'].empty? page.errors << OpenStruct.new({ :severity => 'info', :category => 'HTML Compatibility/Correctness', :type => '<a href=""> empty', :title => %Q{<a href=""> empty (line #{a.line})}, :message => %Q{<a href=""> empty}, :snippet => a.to_s, :icon => 'fa-info' }) end end end |