kasket 0.5.4 → 0.5.5

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.5.5
@@ -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?
@@ -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 = Hash[cached_record_map.select { |key, record| record.nil? }].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 = Hash[id_to_key_map.invert.select { |key, id| missing_keys.include?(key) }].values
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)
@@ -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
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-01 00:00:00 -08:00
12
+ date: 2009-12-02 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency