isomorfeus-data 2.0.3 → 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/data/version.rb +1 -1
- data/lib/isomorfeus_data/lucid_query_result.rb +26 -8
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb9108f2f9e715878385080c0baaa26f956306df3aaa7972671909c1ebefb5cd
|
4
|
+
data.tar.gz: 19e1f6d114a2bb41d3ccf8a5d06c18ea788f19d84e5c695c701889857f4709d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd5ec492a7d4a2332c54d8d796ec384acf73d83bf0942e9f1484abc2572fb11b37e39760467ee7b2f5d9279deac3409e855d47e56b1113ed0509912c2088b5dc
|
7
|
+
data.tar.gz: 5d4f243fdbc432b8b2b435e45bbf6c94c8e6bef437fb8ff9ff8cfe00f15f92f977a249fe808e51a209a4c849dcff80ccb5fca7ef9ba16f5d6d3c611baa943cce
|
@@ -40,14 +40,18 @@ class LucidQueryResult
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def method_missing(accessor_name, *args, &block)
|
43
|
-
|
43
|
+
sid_or_array = if @result_set
|
44
44
|
@result_set[accessor_name]
|
45
45
|
else
|
46
46
|
stored_results = Redux.fetch_by_path(:data_state, @class_name, @key)
|
47
47
|
stored_results.JS[accessor_name] if stored_results
|
48
48
|
end
|
49
|
-
Isomorfeus.raise_error(message: "#{@class_name}: no such thing '#{accessor_name}' in the results!") unless
|
50
|
-
|
49
|
+
Isomorfeus.raise_error(message: "#{@class_name}: no such thing '#{accessor_name}' in the results!") unless sid_or_array
|
50
|
+
if stored_results.JS['_is_array_']
|
51
|
+
sid_or_array.map { |sid| Isomorfeus.instance_from_sid(sid) }
|
52
|
+
else
|
53
|
+
Isomorfeus.instance_from_sid(sid_or_array)
|
54
|
+
end
|
51
55
|
end
|
52
56
|
else
|
53
57
|
def initialize(key: nil, result_set: {})
|
@@ -77,8 +81,13 @@ class LucidQueryResult
|
|
77
81
|
|
78
82
|
def to_transport
|
79
83
|
sids_hash = {}
|
80
|
-
@result_set.each do |key,
|
81
|
-
|
84
|
+
@result_set.each do |key, value_or_array|
|
85
|
+
if value_or_array.class == Array
|
86
|
+
sids_hash[key.to_s] = value_or_array.map(&:sid)
|
87
|
+
sids_hash[:_is_array_] = true
|
88
|
+
else
|
89
|
+
sids_hash[key.to_s] = value_or_array.sid
|
90
|
+
end
|
82
91
|
end
|
83
92
|
{ @class_name => { @key => sids_hash }}
|
84
93
|
end
|
@@ -86,9 +95,18 @@ class LucidQueryResult
|
|
86
95
|
def included_items_to_transport
|
87
96
|
data_hash = {}
|
88
97
|
@result_set.each_value do |value|
|
89
|
-
|
90
|
-
|
91
|
-
|
98
|
+
if value.class == Array
|
99
|
+
value.each do |v|
|
100
|
+
data_hash.deep_merge!(v.to_transport)
|
101
|
+
if v.respond_to?(:included_items_to_transport)
|
102
|
+
data_hash.deep_merge!(v.included_items_to_transport)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
else
|
106
|
+
data_hash.deep_merge!(value.to_transport)
|
107
|
+
if value.respond_to?(:included_items_to_transport)
|
108
|
+
data_hash.deep_merge!(value.included_items_to_transport)
|
109
|
+
end
|
92
110
|
end
|
93
111
|
end
|
94
112
|
data_hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isomorfeus-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -142,28 +142,28 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.0.
|
145
|
+
version: 2.0.4
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 2.0.
|
152
|
+
version: 2.0.4
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: isomorfeus
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - '='
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 2.0.
|
159
|
+
version: 2.0.4
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - '='
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 2.0.
|
166
|
+
version: 2.0.4
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rake
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|