Class: Amazon::SDB::ResultSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/amazon_sdb/resultset.rb

Overview

Represents a ResultSet returned from Domain#query. Currently, this is just a set of Items plus an operation to see if there is another set to be retrieved and to load it on demand. When Amazon sees fit to add total results or other metadata for queries that will also be included here.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(domain, items, more_token = nil) ⇒ ResultSet

Returns a new instance of ResultSet.



13
14
15
16
17
# File 'lib/amazon_sdb/resultset.rb', line 13

def initialize(domain, items, more_token = nil)
  @domain = domain
  @items = items
  @more_token = more_token
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



11
12
13
# File 'lib/amazon_sdb/resultset.rb', line 11

def items
  @items
end

Instance Method Details

#eachObject

Support method for Enumerable. Iterates through the items in this set (NOT all the matching results for a query)



38
39
40
41
42
# File 'lib/amazon_sdb/resultset.rb', line 38

def each
  @items.each do |i|
    yield i
  end
end

#keysObject

Iterator through all the keys in this resultset



32
33
34
# File 'lib/amazon_sdb/resultset.rb', line 32

def keys
  @items.map {|i| i.key }
end

#load_next!Object

Not implemented yet



27
28
# File 'lib/amazon_sdb/resultset.rb', line 27

def load_next!
end

#more_items?Boolean

Returns true if there is another result set to be loaded

Returns:

  • (Boolean)


21
22
23
# File 'lib/amazon_sdb/resultset.rb', line 21

def more_items?
  not @more_token.nil?
end