looksist 0.3.8 → 0.3.9
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.
- checksums.yaml +4 -4
- data/lib/looksist/hashed.rb +1 -5
- data/lib/looksist/version.rb +1 -1
- data/spec/looksist/hashed_spec.rb +8 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6738e7223eb398300b1f39bbff473a32be03e0ac
|
4
|
+
data.tar.gz: e1038299efa273e12ba68e547d0a315f6126eb01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a264b8c03bb41a8db5821ae12fc5c33b9db7d4a991f47461764d7aebbf8adde22334461aadacb13ccc1f408be97d74c6b3dab8648c401d565165442f54e46691
|
7
|
+
data.tar.gz: bcf2614b4341eaebe18b9dd043ae340919c6a0312443e0f992ce71e7ed137b6bf9179d8a64c1b261d7a4a15eeee995959f791210b31969a37d6804e0bc2fe4fb
|
data/lib/looksist/hashed.rb
CHANGED
@@ -105,11 +105,7 @@ module Looksist
|
|
105
105
|
def inject_attributes_for_array(array_of_hashes, at, opts)
|
106
106
|
all_values = opts.each_with_object({}) do |opt, acc|
|
107
107
|
entity_name = __entity__(opt[:bucket_name] || opt[:using])
|
108
|
-
modified_array =
|
109
|
-
array_of_hashes.map(&:values)
|
110
|
-
else
|
111
|
-
extract_values(array_of_hashes, opt[:using])
|
112
|
-
end
|
108
|
+
modified_array = extract_values(array_of_hashes, opt[:using])
|
113
109
|
keys = modified_array.flatten.compact.uniq
|
114
110
|
values = Hash[keys.zip(Looksist.redis_service.send("#{entity_name}_for", keys))]
|
115
111
|
acc[opt[:using]] = values
|
data/lib/looksist/version.rb
CHANGED
@@ -398,10 +398,12 @@ describe Looksist::Hashed do
|
|
398
398
|
def metrics
|
399
399
|
[
|
400
400
|
{
|
401
|
-
item_id: 1
|
401
|
+
item_id: 1,
|
402
|
+
item_preference:'Low'
|
402
403
|
},
|
403
404
|
{
|
404
|
-
item_id: 2
|
405
|
+
item_id: 2,
|
406
|
+
item_preference:'High'
|
405
407
|
}
|
406
408
|
]
|
407
409
|
end
|
@@ -414,11 +416,13 @@ describe Looksist::Hashed do
|
|
414
416
|
expect(ArrayOfHashes.new.metrics).to eq(
|
415
417
|
[{
|
416
418
|
item_id: 1,
|
417
|
-
dish_name: 'Idly'
|
419
|
+
dish_name: 'Idly',
|
420
|
+
item_preference:'Low'
|
418
421
|
},
|
419
422
|
{
|
420
423
|
item_id: 2,
|
421
|
-
dish_name: 'Pongal'
|
424
|
+
dish_name: 'Pongal',
|
425
|
+
item_preference:'High'
|
422
426
|
}]
|
423
427
|
)
|
424
428
|
|