Module: Yahoo::SE::Paginator
Instance Method Summary collapse
- #last? ⇒ Boolean
- #method_missing(method, *args) ⇒ Object
-
#next ⇒ Object
Reset the start option to the next results.
-
#response ⇒ Object
The response object from the request.
- #total_results_available ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
25 26 27 28 |
# File 'lib/yahoo-se/paginator.rb', line 25 def method_missing(method, *args) results response.send(method, *args) end |
Instance Method Details
#last? ⇒ Boolean
21 22 23 |
# File 'lib/yahoo-se/paginator.rb', line 21 def last? (@options[:start] + @options[:results]) >= response.total_results_available end |
#next ⇒ Object
Reset the start option to the next results
11 12 13 14 15 |
# File 'lib/yahoo-se/paginator.rb', line 11 def next @options[:start] = @options[:start] + @options[:results] @options[:results] = total_results_available - @options[:start] if last? results end |
#response ⇒ Object
The response object from the request
5 6 7 8 |
# File 'lib/yahoo-se/paginator.rb', line 5 def response raise "Must send a request before you can get a response. Run the results method first!" if @request.nil? @response = @request.response end |
#total_results_available ⇒ Object
17 18 19 |
# File 'lib/yahoo-se/paginator.rb', line 17 def total_results_available @total_results_available ||= response.total_results_available end |