Class: YahooSiteExplorer::Backlinks
- Inherits:
-
ResultsContainer
- Object
- ResultsContainer
- YahooSiteExplorer::Backlinks
- Defined in:
- lib/yahoo_site_explorer/backlinks.rb
Instance Attribute Summary
Attributes inherited from ResultsContainer
#first_result_position, #results, #total_results_available, #total_results_returned
Instance Method Summary collapse
-
#each ⇒ Object
This method will step through all of the results supplied by Yahoo! for your given query.
-
#next_set ⇒ Object
Returns the next Backlinks set based on available results from Yahoo! specific to the current query and request options.
Methods inherited from ResultsContainer
Constructor Details
This class inherits a constructor from YahooSiteExplorer::ResultsContainer
Instance Method Details
#each ⇒ Object
This method will step through all of the results supplied by Yahoo! for your given query. This method acts like a cursor and will automatically re-query Yahoo! after for any subsequent set of results
results (i.e. if your original query asked for 50 results at a time, this method will act as a cursor, pulling 50 results at a time over the entire resulting collection).
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/yahoo_site_explorer/backlinks.rb', line 16 def each backlinks = self records = self.results while !records.empty? records.each { |record| yield record } backlinks = backlinks.next_set records = backlinks.results end self end |
#next_set ⇒ Object
Returns the next Backlinks set based on available results from Yahoo! specific to the current query and request options.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/yahoo_site_explorer/backlinks.rb', line 31 def next_set #:nodoc: if next_starting_position <= @total_results_available @service.backlinks( @request_options.delete(:url), @request_options.merge({ :start => next_starting_position }) ) else Backlinks.new(@service, @request_options, { :total_results_available => @total_results_available, :total_results_returned => 0, :first_result_position => next_starting_position, :results => [] }) end end |