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.
7 8 9 |
# File 'lib/blinkr/extensions/empty_a_href.rb', line 7 def initialize config @config = config end |
Instance Method Details
#collect(page) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/blinkr/extensions/empty_a_href.rb', line 11 def collect page page.body.css('a[href]').each do |a| if a['href'].empty? page.errors << Blinkr::Error.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 |