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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e7d3a63b82aa23807652084785e34c7aaa4532b1ca8c5974dec329ff6a6a68e
4
- data.tar.gz: 6ee00c5027f31cf65d7be1bdd7f273931f330b9713ff2095d57dc7f9aac7ef8e
3
+ metadata.gz: cb9108f2f9e715878385080c0baaa26f956306df3aaa7972671909c1ebefb5cd
4
+ data.tar.gz: 19e1f6d114a2bb41d3ccf8a5d06c18ea788f19d84e5c695c701889857f4709d4
5
5
  SHA512:
6
- metadata.gz: 898bd0cef81d36805a5e91a0dadb01765ff7ee468856006a284301d9327029a4408ddf1791b3364a9fd8d71ff44ecf6aa52f3a865bd895dc166b25ce734cce92
7
- data.tar.gz: d3fcc90ec548530f70100bfdd461da71f6bef789c7304d6b2ce6504ab59e3335f8b7444952fef8c892306210f44cf8bf6c49edd2954cc2bd1fc768e23731694a
6
+ metadata.gz: dd5ec492a7d4a2332c54d8d796ec384acf73d83bf0942e9f1484abc2572fb11b37e39760467ee7b2f5d9279deac3409e855d47e56b1113ed0509912c2088b5dc
7
+ data.tar.gz: 5d4f243fdbc432b8b2b435e45bbf6c94c8e6bef437fb8ff9ff8cfe00f15f92f977a249fe808e51a209a4c849dcff80ccb5fca7ef9ba16f5d6d3c611baa943cce
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Data
3
- VERSION = '2.0.3'
3
+ VERSION = '2.0.4'
4
4
  end
5
5
  end
@@ -40,14 +40,18 @@ class LucidQueryResult
40
40
  end
41
41
 
42
42
  def method_missing(accessor_name, *args, &block)
43
- sid = if @result_set
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 sid
50
- Isomorfeus.instance_from_sid(sid)
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, value|
81
- sids_hash[key.to_s] = value.sid
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
- data_hash.deep_merge!(value.to_transport)
90
- if value.respond_to?(:included_items_to_transport)
91
- data_hash.deep_merge!(value.included_items_to_transport)
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.3
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-21 00:00:00.000000000 Z
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.3
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.3
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.3
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.3
166
+ version: 2.0.4
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rake
169
169
  requirement: !ruby/object:Gem::Requirement