Class: Amazon::SDB::ResultSet

Inherits:
Array
  • Object
show all
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, next_token = nil) ⇒ ResultSet

Returns a new instance of ResultSet.



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

def initialize(domain, items, next_token = nil)
  @domain = domain
  @items = items
  super(@items)
  @next_token = next_token
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



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

def items
  @items
end

Instance Method Details

#keysObject

Iterator through all the keys in this resultset



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

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

#load_next!Object

Not implemented yet



29
30
31
32
33
34
35
# File 'lib/amazon_sdb/resultset.rb', line 29

def load_next!
  if @more_token.nil?
    @items = []
  else
    @items = @domain.query(:next_token => @next_token)
  end
end

#more_items?Boolean

Returns true if there is another result set to be loaded

Returns:

  • (Boolean)


23
24
25
# File 'lib/amazon_sdb/resultset.rb', line 23

def more_items?
  not @more_token.nil?
end