looksist 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/looksist/common.rb +2 -1
- data/lib/looksist/core.rb +2 -2
- data/lib/looksist/hashed.rb +2 -2
- data/lib/looksist/version.rb +1 -1
- 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: 52851b1abadfa5c5e0e753e84291b22643b25d21
|
4
|
+
data.tar.gz: d6cde88e787c76b7a18048ceb7c968f0f9094f10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e693cb1c71e42a59e51be1ae75e7c2d9830ca5289cef58cc5dc5f0123a743e558b0bd648600c2a6966a415354ccd065face0051f4b0e8747a791aad1827b286
|
7
|
+
data.tar.gz: 563492167cc926ab5c282bb16c2e4473eee199c2a6152543ba8e725d15fe5a530db3ead9c8371925ff97ae0505a54c9cd9812a6b8d861cd87530c570efbdf760
|
data/lib/looksist/common.rb
CHANGED
data/lib/looksist/core.rb
CHANGED
@@ -11,13 +11,13 @@ module Looksist
|
|
11
11
|
if what.is_a? Array
|
12
12
|
what.each do |method_name|
|
13
13
|
define_method(method_name) do
|
14
|
-
JSON.parse(Looksist.redis_service.send("#{
|
14
|
+
JSON.parse(Looksist.redis_service.send("#{__entity__(bucket)}_for", self.send(using).try(:to_s)) || '{}')[method_name.to_s]
|
15
15
|
end
|
16
16
|
self.lookup_attributes << method_name
|
17
17
|
end
|
18
18
|
else
|
19
19
|
define_method(what) do
|
20
|
-
Looksist.redis_service.send("#{
|
20
|
+
Looksist.redis_service.send("#{__entity__(bucket)}_for", self.send(using).try(:to_s))
|
21
21
|
end
|
22
22
|
self.lookup_attributes << what.to_sym
|
23
23
|
end
|
data/lib/looksist/hashed.rb
CHANGED
@@ -43,14 +43,14 @@ module Looksist
|
|
43
43
|
def inject_attributes_at(hash_offset, opts)
|
44
44
|
return nil unless hash_offset
|
45
45
|
keys = hash_offset[opts[:using]]
|
46
|
-
entity_name =
|
46
|
+
entity_name = __entity__(opts[:using])
|
47
47
|
values = Looksist.redis_service.send("#{entity_name}_for", keys)
|
48
48
|
hash_offset[opts[:populate]] = values
|
49
49
|
hash_offset
|
50
50
|
end
|
51
51
|
|
52
52
|
def inject_attributes_for(arry_of_hashes, opts)
|
53
|
-
entity_name =
|
53
|
+
entity_name = __entity__(opts[:using])
|
54
54
|
keys = (arry_of_hashes.collect { |i| i[opts[:using]] }).compact.uniq
|
55
55
|
values = keys.zip(Looksist.redis_service.send("#{entity_name}_for", keys)).to_h
|
56
56
|
arry_of_hashes.each do |elt|
|
data/lib/looksist/version.rb
CHANGED