Class: Google::CustomSearch::JSON::Results
- Inherits:
-
Object
- Object
- Google::CustomSearch::JSON::Results
- Includes:
- Enumerable
- Defined in:
- lib/google/custom_search/json/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.
11 12 13 |
# File 'lib/google/custom_search/json/results.rb', line 11 def initialize(response) @data = ::JSON.parse(response) end |
Instance Method Details
#current_page ⇒ Object
31 32 33 |
# File 'lib/google/custom_search/json/results.rb', line 31 def current_page Page.new(@data['queries']['request']) end |
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/google/custom_search/json/results.rb', line 15 def each(&block) items.each(&block) end |
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/google/custom_search/json/results.rb', line 19 def empty? items.empty? end |
#length ⇒ Object
23 24 25 |
# File 'lib/google/custom_search/json/results.rb', line 23 def length items.length end |