simple_record 1.1.55 → 1.1.56

Sign up to get free protection for your applications and to get access to all the features.
data/lib/simple_record.rb CHANGED
@@ -426,6 +426,7 @@ module SimpleRecord
426
426
  end
427
427
  end
428
428
  # puts '@atts2=' + @attributes.inspect
429
+ @attributes_rb = {} unless @attributes_rb # was getting errors after upgrade.
429
430
  @attributes_rb.clear # clear out the ruby versions so they can reload on next get.
430
431
  if ret
431
432
  self.class.cache_results(self)
@@ -515,6 +516,7 @@ module SimpleRecord
515
516
  # puts "defined?(#{instance_var.to_sym}) " + (defined?(instance_var.to_sym)).inspect
516
517
  # if defined?(instance_var.to_sym) # this returns "method" for some reason??
517
518
  # puts "attribute #{instance_var} is defined"
519
+ @attributes_rb = {} unless @attributes_rb # was getting errors after upgrade.
518
520
  ret = @attributes_rb[arg_s] # instance_variable_get(instance_var)
519
521
  # puts 'ret=' + ret.to_s
520
522
  return ret if !ret.nil?
@@ -19,7 +19,6 @@ module SimpleRecord
19
19
  @items = items
20
20
  @currentset_items = items
21
21
  @next_token = next_token
22
- @i = 0
23
22
  end
24
23
 
25
24
  def << (val)
@@ -91,14 +90,18 @@ module SimpleRecord
91
90
  end
92
91
 
93
92
  def each(&blk)
93
+ each2(0, &blk)
94
+ end
95
+
96
+ def each2(i, &blk)
94
97
  options = @params[1]
95
98
  limit = options[:limit]
96
99
 
97
- @currentset_items.each do |v|
100
+ @items.each do |v|
98
101
  # puts @i.to_s
99
102
  yield v
100
- @i += 1
101
- if !limit.nil? && @i >= limit
103
+ i += 1
104
+ if !limit.nil? && i >= limit
102
105
  return
103
106
  end
104
107
  end
@@ -111,7 +114,7 @@ module SimpleRecord
111
114
  #puts "i from results_array = " + @i.to_s
112
115
 
113
116
  load_next_token_set
114
- each(&blk)
117
+ each2(i, &blk)
115
118
  end
116
119
  end
117
120
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.55
4
+ version: 1.1.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2010-01-02 00:00:00 -08:00
14
+ date: 2010-01-03 00:00:00 -08:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency