Class: Anemone::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/speed_spider/anemone_hack.rb

Instance Method Summary collapse

Instance Method Details

#assets?(link) ⇒ Boolean

Returns:

  • (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

Returns true if link should not be visited because its URL matches a skip_link pattern.

Returns:

  • (Boolean)


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