Class: SimpleGoogleCustomSearch::ResultSet

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_google_custom_search/result_set.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ ResultSet

Returns a new instance of ResultSet.



4
5
6
7
# File 'lib/simple_google_custom_search/result_set.rb', line 4

def initialize(attrs={})
  @total = attrs[:total] || 0
  @item = attrs[:item] || []
end

Instance Attribute Details

#itemObject

Returns the value of attribute item.



2
3
4
# File 'lib/simple_google_custom_search/result_set.rb', line 2

def item
  @item
end

#totalObject

Returns the value of attribute total.



2
3
4
# File 'lib/simple_google_custom_search/result_set.rb', line 2

def total
  @total
end

Class Method Details

.create_emptyObject



9
10
11
12
13
14
# File 'lib/simple_google_custom_search/result_set.rb', line 9

def self.create_empty
  self.new({
    total: 0,
    item: []
  })
end