Class: Anemone::Core
- Inherits:
-
Object
- Object
- Anemone::Core
- Defined in:
- lib/speed_spider/anemone_hack.rb
Instance Method Summary collapse
- #assets?(link) ⇒ Boolean
-
#skip_link_with_hack?(link) ⇒ Boolean
(also: #skip_link?)
Returns
true
if link should not be visited because its URL matches a skip_link pattern.
Instance Method Details
#assets?(link) ⇒ Boolean
3 4 5 6 7 |
# File 'lib/speed_spider/anemone_hack.rb', line 3 def assets?(link) %w(js css jpg jpeg png bmp gif svg ttf woff eot).any? do |e| /#{e}/i =~ File.extname(link.path).split('.').pop end end |
#skip_link_with_hack?(link) ⇒ Boolean Also known as: skip_link?
Returns true
if link should not be visited because its URL matches a skip_link pattern.
12 13 14 |
# File 'lib/speed_spider/anemone_hack.rb', line 12 def skip_link_with_hack?(link) skip_link_without_hack?(link) or !assets?(link) and !link.to_s.start_with? @opts[:base_url] end |