Sha256: 2b43d9b8dabc279c4d97c87ca8df12754a85d65c7d46b115b3c048d6d4aa467f
Contents?: true
Size: 700 Bytes
Versions: 9
Compression:
Stored size: 700 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-list li.pagination-page').text.split(/\s+/).map(&:to_i)].flatten.compact.max end def params # to be overriden {} end end end
Version data entries
9 entries across 9 versions & 1 rubygems