kasket 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/kasket/cache.rb +1 -1
- data/lib/kasket/read_mixin.rb +3 -3
- data/lib/kasket/write_mixin.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.5
|
data/lib/kasket/cache.rb
CHANGED
@@ -18,7 +18,7 @@ module Kasket
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_multi(keys)
|
21
|
-
map = Hash[keys.zip(keys.map { |key| @local_cache[key] })]
|
21
|
+
map = Hash[*keys.zip(keys.map { |key| @local_cache[key] }).flatten]
|
22
22
|
missing_keys = map.select { |key, value| value.nil? }.map(&:first)
|
23
23
|
|
24
24
|
unless missing_keys.empty?
|
data/lib/kasket/read_mixin.rb
CHANGED
@@ -54,14 +54,14 @@ module Kasket
|
|
54
54
|
limit = (options[:limit] || (scope(:find) || {})[:limit])
|
55
55
|
|
56
56
|
if limit.nil? && attribute_value_pairs && has_kasket_index_on?(attribute_value_pairs.map(&:first))
|
57
|
-
id_to_key_map = Hash[ids.uniq.map { |id| [id, kasket_key_for_id(id)] }]
|
57
|
+
id_to_key_map = Hash[*ids.uniq.map { |id| [id, kasket_key_for_id(id)] }.flatten]
|
58
58
|
cached_record_map = Kasket.cache.get_multi(id_to_key_map.values)
|
59
59
|
|
60
|
-
missing_keys =
|
60
|
+
missing_keys = cached_record_map.select { |key, record| record.nil? }.map(&:first)
|
61
61
|
|
62
62
|
return cached_record_map.values if missing_keys.empty?
|
63
63
|
|
64
|
-
missing_ids =
|
64
|
+
missing_ids = id_to_key_map.invert.select { |key, id| missing_keys.include?(key) }.map(&:last)
|
65
65
|
|
66
66
|
db_records = without_kasket do
|
67
67
|
find_some_without_kasket(missing_ids, options)
|
data/lib/kasket/write_mixin.rb
CHANGED
@@ -28,7 +28,7 @@ module Kasket
|
|
28
28
|
attribute_sets = [attributes.symbolize_keys]
|
29
29
|
|
30
30
|
if changed?
|
31
|
-
old_attributes = Hash[changes.map {|attribute, values| [attribute, values[0]]}].symbolize_keys
|
31
|
+
old_attributes = Hash[*changes.map {|attribute, values| [attribute, values[0]]}.flatten].symbolize_keys
|
32
32
|
attribute_sets << old_attributes.reverse_merge(attribute_sets[0])
|
33
33
|
end
|
34
34
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kasket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mick Staugaard
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-02 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|