Sha256: d51c23cf1bf4abfbfb71696ca7e90f35e7336ad7a6b089aef0c4fb2bf7297d54
Contents?: true
Size: 613 Bytes
Versions: 1
Compression:
Stored size: 613 Bytes
Contents
require 'page_by_page/version' require 'page_by_page/url' require 'nokogiri' require 'open-uri' class PageByPage class << self def fetch &block pbp = self.new &block pbp.fetch end end def initialize &block instance_eval &block end def url tmpl @url = Url.new tmpl end def selector sl @selector = sl end def fetch items, all_items = [nil], [] until items.empty? doc = parse @url.next items = doc.css @selector all_items << items end all_items.flatten end private def parse url Nokogiri::HTML open url end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
page_by_page-0.1.0 | lib/page_by_page.rb |