Class: Google::CustomSearch::XML::Results
- Inherits:
-
Object
- Object
- Google::CustomSearch::XML::Results
- Includes:
- Enumerable
- Defined in:
- lib/google/custom_search/xml/results.rb
Defined Under Namespace
Classes: Page
Instance Method Summary collapse
- #current_page ⇒ Object
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(response) ⇒ Results
constructor
A new instance of Results.
- #length ⇒ Object
- #next_page ⇒ Object
- #previous_page ⇒ Object
Constructor Details
#initialize(response) ⇒ Results
Returns a new instance of Results.
12 13 14 |
# File 'lib/google/custom_search/xml/results.rb', line 12 def initialize(response) @doc = Nokogiri::XML.parse(response) end |
Instance Method Details
#current_page ⇒ Object
33 34 35 |
# File 'lib/google/custom_search/xml/results.rb', line 33 def current_page Page.from_xml(@doc.search('//RES').first) end |
#each(&block) ⇒ Object
16 17 18 |
# File 'lib/google/custom_search/xml/results.rb', line 16 def each(&block) items.each(&block) end |
#empty? ⇒ Boolean
20 21 22 |
# File 'lib/google/custom_search/xml/results.rb', line 20 def empty? items.empty? end |
#length ⇒ Object
24 25 26 |
# File 'lib/google/custom_search/xml/results.rb', line 24 def length items.length end |