Class: Gcloud::Datastore::Dataset::LookupResults
- Inherits:
-
Array
- Object
- Array
- Gcloud::Datastore::Dataset::LookupResults
- Defined in:
- lib/gcloud/datastore/dataset/lookup_results.rb
Overview
LookupResults is a special case Array with additional values. A LookupResults object is returned from Dataset#find_all and contains the entities as well as the Keys that were deferred from the results and the Entities that were missing in the dataset.
entities = dataset.find_all key1, key2, key3
entities.size #=> 3
entities.deferred #=> []
entities.missing #=> []
Please be cautious when treating the LookupResults as an Array. Many common Array methods will return a new Array instance.
entities = dataset.find_all key1, key2, key3
entities.size #=> 3
entities.deferred #=> []
entities.missing #=> []
names = entities.map { |e| e["name"] }
names.size #=> 3
names.deferred #=> NoMethodError
names.missing #=> NoMethodError
Instance Attribute Summary collapse
-
#deferred ⇒ Object
Keys that were not looked up due to resource constraints.
-
#missing ⇒ Object
Entities not found, with only the key populated.
Instance Method Summary collapse
-
#initialize(arr = [], deferred = [], missing = []) ⇒ LookupResults
constructor
Create a new LookupResults with an array of values.
Constructor Details
#initialize(arr = [], deferred = [], missing = []) ⇒ LookupResults
Create a new LookupResults with an array of values.
53 54 55 56 57 |
# File 'lib/gcloud/datastore/dataset/lookup_results.rb', line 53 def initialize arr = [], deferred = [], missing = [] super arr @deferred = deferred @missing = missing end |
Instance Attribute Details
#deferred ⇒ Object
Keys that were not looked up due to resource constraints.
45 46 47 |
# File 'lib/gcloud/datastore/dataset/lookup_results.rb', line 45 def deferred @deferred end |
#missing ⇒ Object
Entities not found, with only the key populated.
49 50 51 |
# File 'lib/gcloud/datastore/dataset/lookup_results.rb', line 49 def missing @missing end |