Class: Pollex::PaginatedArray
- Inherits:
-
Array
- Object
- Array
- Pollex::PaginatedArray
- Defined in:
- lib/pollex/scraper.rb
Overview
Array with an optional pointer to the next page of results
Instance Attribute Summary collapse
-
#next_page ⇒ Object
Returns the value of attribute next_page.
-
#query ⇒ Object
Returns the value of attribute query.
Instance Method Summary collapse
- #inspect ⇒ Object
-
#more ⇒ Object
Returns the next page of results, if one exists.
Instance Attribute Details
#next_page ⇒ Object
Returns the value of attribute next_page.
129 130 131 |
# File 'lib/pollex/scraper.rb', line 129 def next_page @next_page end |
#query ⇒ Object
Returns the value of attribute query.
129 130 131 |
# File 'lib/pollex/scraper.rb', line 129 def query @query end |
Instance Method Details
#inspect ⇒ Object
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 |
#more ⇒ Object
Returns the next page of results, if one exists
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 |