class ChambaSearchMx::Pagination

provides the url of the search pagination

Attributes

urls[R]

Public Class Methods

new(opts = {}) click to toggle source

@param <hash> opts @see ChambaSearchMx::BASE_URL

# File lib/chamba_search_mx/pagination.rb, line 9
def initialize(opts = {})
  @urls = []
  @http = opts[:http] || ChambaSearchMx::HTMLPage.new
end

Public Instance Methods

load(url) click to toggle source

@param <string> search page url @return <class> self

# File lib/chamba_search_mx/pagination.rb, line 17
def load(url)
  @http.load url
  @urls = find_pages.map! { |p| p == '#' ? url : p }
  self
end

Private Instance Methods

find_pages() click to toggle source

@return <array> of strings

# File lib/chamba_search_mx/pagination.rb, line 27
def find_pages
  page_links.map { |p| p.css('a').attribute('href').text }
end