Sha256: 0b3e5bd803b53f0f50575abe2def4d857ab3f839832f289ada058091a61aa8c5
Contents?: true
Size: 685 Bytes
Versions: 7
Compression:
Stored size: 685 Bytes
Contents
module Notu module Listing include Enumerable attr_reader :library def initialize(library) raise ArgumentError.new("#{self.class}#library must be a library, #{library.inspect} given") unless library.is_a?(Library) @library = library end def page_urls (1..pages_count).map do |index| library.url(path: path, query: params.merge('page' => index)) end end def pages_count document = HtmlDocument.get(library.url(path: path, query: params)) [1, (document/'ul.pagination li.pages').text.split(/\s+/).map(&:to_i)].flatten.compact.max end def params # to be overriden {} end end end
Version data entries
7 entries across 7 versions & 1 rubygems