appoxy-simple_record 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/results_array.rb +14 -2
- data/lib/simple_record.rb +3 -1
- metadata +1 -1
data/lib/results_array.rb
CHANGED
@@ -10,7 +10,7 @@ module SimpleRecord
|
|
10
10
|
#puts 'params in ra=' + params.inspect
|
11
11
|
@items = items
|
12
12
|
@next_token = next_token
|
13
|
-
@i = 0
|
13
|
+
@i = 0
|
14
14
|
end
|
15
15
|
|
16
16
|
def << (val)
|
@@ -21,6 +21,18 @@ module SimpleRecord
|
|
21
21
|
@items[i]
|
22
22
|
end
|
23
23
|
|
24
|
+
def size
|
25
|
+
return @count if @count
|
26
|
+
params_for_count = params.dup
|
27
|
+
params_for_count[0] = :count
|
28
|
+
@count = clz.find(*params)
|
29
|
+
@count
|
30
|
+
end
|
31
|
+
|
32
|
+
def length
|
33
|
+
return size
|
34
|
+
end
|
35
|
+
|
24
36
|
|
25
37
|
def each(&blk)
|
26
38
|
limit = nil
|
@@ -31,7 +43,7 @@ module SimpleRecord
|
|
31
43
|
options = {}
|
32
44
|
params[1] = options
|
33
45
|
end
|
34
|
-
|
46
|
+
|
35
47
|
@items.each do |v|
|
36
48
|
puts @i.to_s
|
37
49
|
yield v
|
data/lib/simple_record.rb
CHANGED
@@ -866,7 +866,9 @@ This is done on getters now
|
|
866
866
|
results=super(*params)
|
867
867
|
if q_type != :count
|
868
868
|
cache_results(results)
|
869
|
-
results
|
869
|
+
if results.is_a?(Array)
|
870
|
+
results = SimpleRecord::ResultsArray.new(self, params, results, next_token)
|
871
|
+
end
|
870
872
|
end
|
871
873
|
rescue RightAws::AwsError, RightAws::ActiveSdb::ActiveSdbError
|
872
874
|
puts "RESCUED: " + $!.message
|