cached_resource 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,7 +64,7 @@ module CachedResource
64
64
  collection = cache_read(cached_resource.collection_arguments)
65
65
 
66
66
  if collection && !updates.empty?
67
- store = RUBY_VERSION.to_f < 1.9 ? ActiveSupport::OrderedHash.new : {}
67
+ store = CachedResource::Configuration::ORDERED_HASH.new
68
68
  index = collection.inject(store) { |hash, object| hash[object.send(primary_key)] = object; hash }
69
69
  updates.each { |object| index[object.send(primary_key)] = object }
70
70
  cache_write(cached_resource.collection_arguments, index.values)
@@ -3,6 +3,9 @@ module CachedResource
3
3
  # for cached resource.
4
4
  class Configuration < OpenStruct
5
5
 
6
+ # Determine and set an appropriate ordered hash based on the current ruby version
7
+ ORDERED_HASH = RUBY_VERSION.to_f < 1.9 ? ActiveSupport::OrderedHash : Hash
8
+
6
9
  # default or fallback cache without rails
7
10
  CACHE = ActiveSupport::Cache::MemoryStore.new
8
11
 
@@ -1,3 +1,3 @@
1
1
  module CachedResource
2
- VERSION = "2.3.0"
2
+ VERSION = "2.3.1"
3
3
  end
metadata CHANGED
@@ -1,77 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cached_resource
3
- version: !ruby/object:Gem::Version
4
- version: 2.3.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 1
5
5
  prerelease:
6
+ segments:
7
+ - 2
8
+ - 3
9
+ - 1
10
+ version: 2.3.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Andrew Chan
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-05-12 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-05-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rake
16
- requirement: &70156223360120 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
22
32
  type: :runtime
23
- prerelease: false
24
- version_requirements: *70156223360120
25
- - !ruby/object:Gem::Dependency
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
26
35
  name: activeresource
27
- requirement: &70156223383920 !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
28
38
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
33
46
  type: :runtime
34
- prerelease: false
35
- version_requirements: *70156223383920
36
- - !ruby/object:Gem::Dependency
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
37
49
  name: activesupport
38
- requirement: &70156223383060 !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
39
52
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
44
60
  type: :runtime
45
- prerelease: false
46
- version_requirements: *70156223383060
47
- - !ruby/object:Gem::Dependency
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
48
63
  name: nilio
49
- requirement: &70156223382540 !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
55
74
  type: :runtime
56
- prerelease: false
57
- version_requirements: *70156223382540
58
- - !ruby/object:Gem::Dependency
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
59
77
  name: rspec
60
- requirement: &70156223382020 !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
61
80
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
66
88
  type: :development
67
- prerelease: false
68
- version_requirements: *70156223382020
89
+ version_requirements: *id005
69
90
  description: Enables request-based caching for ActiveResource
70
91
  email: email@suspi.net
71
92
  executables: []
93
+
72
94
  extensions: []
95
+
73
96
  extra_rdoc_files: []
74
- files:
97
+
98
+ files:
75
99
  - .gitignore
76
100
  - .rspec
77
101
  - .travis.yml
@@ -90,29 +114,38 @@ files:
90
114
  - spec/spec_helper.rb
91
115
  homepage: http://github.com/Ahsizara/cached_resource
92
116
  licenses: []
117
+
93
118
  post_install_message:
94
119
  rdoc_options: []
95
- require_paths:
120
+
121
+ require_paths:
96
122
  - lib
97
- required_ruby_version: !ruby/object:Gem::Requirement
123
+ required_ruby_version: !ruby/object:Gem::Requirement
98
124
  none: false
99
- requirements:
100
- - - ! '>='
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ hash: 3
129
+ segments:
130
+ - 0
131
+ version: "0"
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
133
  none: false
105
- requirements:
106
- - - ! '>='
107
- - !ruby/object:Gem::Version
108
- version: '0'
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ hash: 3
138
+ segments:
139
+ - 0
140
+ version: "0"
109
141
  requirements: []
142
+
110
143
  rubyforge_project:
111
- rubygems_version: 1.8.15
144
+ rubygems_version: 1.8.11
112
145
  signing_key:
113
146
  specification_version: 3
114
147
  summary: Caching for ActiveResource
115
- test_files:
148
+ test_files:
116
149
  - spec/cached_resource/caching_spec.rb
117
150
  - spec/cached_resource/configuration_spec.rb
118
151
  - spec/spec_helper.rb