class Dumper::Profiles::Teca

Public Instance Methods

dump(url, path, from, to) click to toggle source
# File lib/dumper/profiles/teca.rb, line 24
def dump(url, path, from, to)
  from -= 1
  to   -= 1 if to >= 1
  url   = url.split('index').first

  [].tap { |urls|
    Nokogiri::HTML(open(url)).xpath('//a/@href').each { |u|
      urls << u if u.to_s =~ /.\.(png|bmp|jpeg|jpg|gif|tiff)$/i
    }
  }.reverse[from..to].each { |p|
    @pool.process {
      Dumper.get path, "#{url}/#{p}"
    }
  }
end