Class: Pollex::PaginatedArray

Inherits:
Array
  • Object
show all
Defined in:
lib/pollex/scraper.rb

Overview

Array with an optional pointer to the next page of results

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#next_pageObject

Returns the value of attribute next_page.



129
130
131
# File 'lib/pollex/scraper.rb', line 129

def next_page
  @next_page
end

#queryObject

Returns the value of attribute query.



129
130
131
# File 'lib/pollex/scraper.rb', line 129

def query
  @query
end

Instance Method Details

#inspectObject



131
132
133
134
135
136
137
# File 'lib/pollex/scraper.rb', line 131

def inspect
  str = super.inspect
  if @next_page
    str += "\nThere are more items available at #{@next_page}. Use _.more to get them."
  end
  str
end

#moreObject

Returns the next page of results, if one exists

See Also:



142
143
144
145
146
147
148
# File 'lib/pollex/scraper.rb', line 142

def more
  if @next_page
    Scraper.instance.get_all(query[:klass], @next_page, query[:attr_infos], query[:table_num])
  else
    nil
  end
end