appoxy-simple_record 1.1.9 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/results_array.rb CHANGED
@@ -3,9 +3,11 @@ module SimpleRecord
3
3
  #
4
4
  # We need to make this behave as if the full set were loaded into the array.
5
5
  class ResultsArray
6
+ include Enumerable
6
7
 
7
8
  attr_reader :next_token, :clz, :params, :items, :i
8
9
 
10
+
9
11
  def initialize(clz=nil, params=[], items=[], next_token=nil)
10
12
  @clz = clz
11
13
  #puts 'class=' + clz.inspect
@@ -24,6 +26,10 @@ module SimpleRecord
24
26
  @items[i]
25
27
  end
26
28
 
29
+ def [](i,j)
30
+ @items[i,j]
31
+ end
32
+
27
33
  def first
28
34
  @items[0]
29
35
  end
@@ -40,10 +46,6 @@ module SimpleRecord
40
46
  @items.include?(obj)
41
47
  end
42
48
 
43
- def include?(obj)
44
- @items.include?(obj)
45
- end
46
-
47
49
  def size
48
50
  # puts 'SIZE count=' + @count.inspect
49
51
  return @count if @count
@@ -70,7 +72,7 @@ module SimpleRecord
70
72
  end
71
73
 
72
74
  @items.each do |v|
73
- puts @i.to_s
75
+ #puts @i.to_s
74
76
  yield v
75
77
  @i += 1
76
78
  if !limit.nil? && @i >= limit
@@ -85,12 +87,15 @@ module SimpleRecord
85
87
  #puts 'params in block=' + params.inspect
86
88
  options[:next_token] = next_token
87
89
  res = clz.find(*params)
88
- @items = res.items
89
- # todo: should append items here instead of replacing the array
90
+ items = res.items
91
+ items.each do |item|
92
+ @items << item
93
+ end
90
94
  @next_token = res.next_token
91
95
  each(&blk)
92
96
  end
93
97
  end
98
+
94
99
  end
95
100
  end
96
101
 
data/lib/simple_record.rb CHANGED
@@ -116,7 +116,7 @@ module SimpleRecord
116
116
 
117
117
 
118
118
  def self.inherited(base)
119
- puts 'SimpleRecord::Base is inherited by ' + base.inspect
119
+ #puts 'SimpleRecord::Base is inherited by ' + base.inspect
120
120
  setup_callbacks(base)
121
121
 
122
122
  base.has_dates :created, :updated
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appoxy-simple_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-08-01 00:00:00 -07:00
13
+ date: 2009-08-04 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16