isomorfeus-data 1.0.0.zeta13 → 1.0.0.zeta14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cee3d71649477f132cee03fd570b5fc5c4ef9430ccad0d40daab90e05525eff
4
- data.tar.gz: 6839dfeb7ceebc8f7311073c31d69f11d73265ab0689d798d2c60754f4e65b72
3
+ metadata.gz: 93156d6e98ea25e9b5710ccfa92e5efadfa0e1f0f5e9e1fa2d9a1aa239a25693
4
+ data.tar.gz: ee280984d99c9a45734a29f99d1108f1da5b37083f6f861573ba3c1b4c40e0e2
5
5
  SHA512:
6
- metadata.gz: 189425d916a46bda087d17a9d49afe58bf6334446605a0d631032aff08b44f0b651acad2dea727ca6499e170d602bfe6cc1dccd31eaf5172ad3b9e737bf6399f
7
- data.tar.gz: bb087ac1acdf8887b28bea4b5c997c2fac9263c500c7e88d18a3ef66115bde41a93bdf2955ac1546bc85e947405720f4e22d36d19abf26dd9388c3956e518dbf
6
+ metadata.gz: 938d8e16c20f5cc9600397d30c9c95c2efaa2774391eda20131c94a0347ec5a724208f1cd2c83fe7d890ea16223c8d68ef9994cf14d495f1db90c00a3bf6627e
7
+ data.tar.gz: 58b5ad7dbe2a9ff0d73b4c86ec93ab62d8f4804a78de8ee22184693aa2cc7b9e6cac55ddb70038486de288f31e10949908557319507d9aa07de2c3082c36a69f
@@ -100,7 +100,7 @@ module Isomorfeus
100
100
  data = instance_exec(key: key, &@_load_block)
101
101
  return nil unless data
102
102
  return data if data.class == self
103
- Isomorfeus.raise_error "#{self.to_s}: execute_load must return a instance of #{self.to_s} or nil. Returned was: #{data.class}." if data.class != self
103
+ Isomorfeus.raise_error(message: "#{self.to_s}: execute_load must return a instance of #{self.to_s} or nil. Returned was: #{data.class}.") if data.class != self
104
104
  data
105
105
  end
106
106
 
@@ -108,7 +108,7 @@ module Isomorfeus
108
108
  previous_key = instance.key
109
109
  data = instance_exec(instance: instance, &@_save_block)
110
110
  return nil unless data
111
- Isomorfeus.raise_error "#{self.to_s}: execute_save must return a instance of #{self.to_s} or nil. Returned was: #{data.class}." if data.class != self
111
+ Isomorfeus.raise_error(message: "#{self.to_s}: execute_save must return a instance of #{self.to_s} or nil. Returned was: #{data.class}.") if data.class != self
112
112
  data.instance_variable_set(:@previous_key, previous_key) if data.key != previous_key
113
113
  data._unchange!
114
114
  data
@@ -1,5 +1,5 @@
1
1
  module Isomorfeus
2
2
  module Data
3
- VERSION = '1.0.0.zeta13'
3
+ VERSION = '1.0.0.zeta14'
4
4
  end
5
5
  end
@@ -461,18 +461,18 @@ module LucidData
461
461
  def instance_from_transport(instance_data, included_items_data)
462
462
  key = instance_data[self.name].keys.first
463
463
  revision = instance_data[self.name][key].key?('revision') ? instance_data[self.name][key]['revision'] : nil
464
- attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'] : nil
464
+ attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'].transform_keys!(&:to_sym) : nil
465
465
  nodes_sids = instance_data[self.name][key].key?('nodes') ? instance_data[self.name][key]['nodes'] : []
466
466
  nodes = []
467
467
  nodes_sids.each do |sid|
468
468
  node_class_name = sid[0]
469
469
  node_key = sid[1]
470
- Isomorfeus.raise_error "#{self.name}: #{node_class_name}: Not a valid LucidData class!" unless Isomorfeus.valid_data_class_name?(node_class_name)
470
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name}: Not a valid LucidData class!") unless Isomorfeus.valid_data_class_name?(node_class_name)
471
471
  if included_items_data.key?(node_class_name) && included_items_data[node_class_name].key?(node_key)
472
472
  node_class = Isomorfeus.cached_data_class(node_class_name)
473
- Isomorfeus.raise_error "#{self.name}: #{node_class_name}: Cannot get class!" unless node_class
473
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name}: Cannot get class!") unless node_class
474
474
  node = node_class.instance_from_transport({ node_class_name => { node_key => included_items_data[node_class_name][node_key] }}, included_items_data)
475
- Isomorfeus.raise_error "#{self.name}: #{node_class_name} with key #{node_key} could not be extracted from transport data!" unless node
475
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name} with key #{node_key} could not be extracted from transport data!") unless node
476
476
  nodes << node
477
477
  end
478
478
  end
@@ -176,18 +176,18 @@ module LucidData
176
176
  def instance_from_transport(instance_data, included_items_data)
177
177
  key = instance_data[self.name].keys.first
178
178
  revision = instance_data[self.name][key].key?('revision') ? instance_data[self.name][key]['revision'] : nil
179
- attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'] : nil
179
+ attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'].transform_keys!(&:to_sym) : nil
180
180
  source_parts = instance_data[self.name][key].key?('parts') ? instance_data[self.name][key]['parts'] : {}
181
181
  parts = {}
182
182
  source_parts.each do |part_name, sid|
183
183
  part_class_name = sid[0]
184
184
  part_key = sid[1]
185
- Isomorfeus.raise_error "#{self.name}: #{part_class_name}: Not a valid LucidData class!" unless Isomorfeus.valid_data_class_name?(part_class_name)
185
+ Isomorfeus.raise_error(message: "#{self.name}: #{part_class_name}: Not a valid LucidData class!") unless Isomorfeus.valid_data_class_name?(part_class_name)
186
186
  if included_items_data.key?(part_class_name) && included_items_data[part_class_name].key?(part_key)
187
187
  part_class = Isomorfeus.cached_data_class(part_class_name)
188
- Isomorfeus.raise_error "#{self.name}: #{part_class_name}: Cannot get class!" unless part_class
188
+ Isomorfeus.raise_error(message: "#{self.name}: #{part_class_name}: Cannot get class!") unless part_class
189
189
  part = part_class.instance_from_transport({ part_class_name => { part_key => included_items_data[part_class_name][part_key] }}, included_items_data)
190
- Isomorfeus.raise_error "#{self.name}: #{part_class_name} with key #{part_key} could not be extracted from transport data!" unless part
190
+ Isomorfeus.raise_error(message: "#{self.name}: #{part_class_name} with key #{part_key} could not be extracted from transport data!") unless part
191
191
  parts[part_name.to_sym] = part
192
192
  end
193
193
  end
@@ -173,7 +173,7 @@ module LucidData
173
173
  def instance_from_transport(instance_data, included_items_data)
174
174
  key = instance_data[self.name].keys.first
175
175
  revision = instance_data[self.name][key].key?('revision') ? instance_data[self.name][key]['revision'] : nil
176
- attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'] : nil
176
+ attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'].transform_keys!(&:to_sym) : nil
177
177
  from_node_sid = instance_data[self.name][key].key?('from') ? instance_data[self.name][key]['from'] : nil
178
178
  to_node_sid = instance_data[self.name][key].key?('to') ? instance_data[self.name][key]['to'] : nil
179
179
  from_to = []
@@ -181,12 +181,12 @@ module LucidData
181
181
  [from_node_sid, to_node_sid].each do |sid|
182
182
  node_class_name = sid[0]
183
183
  node_key = sid[1]
184
- Isomorfeus.raise_error "#{self.name}: #{node_class_name}: Not a valid LucidData class!" unless Isomorfeus.valid_data_class_name?(node_class_name)
184
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name}: Not a valid LucidData class!") unless Isomorfeus.valid_data_class_name?(node_class_name)
185
185
  if included_items_data.key?(node_class_name) && included_items_data[node_class_name].key?(node_key)
186
186
  node_class = Isomorfeus.cached_data_class(node_class_name)
187
- Isomorfeus.raise_error "#{self.name}: #{node_class_name}: Cannot get class!" unless node_class
187
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name}: Cannot get class!") unless node_class
188
188
  node = node_class.instance_from_transport({ node_class_name => { node_key => included_items_data[node_class_name][node_key] }}, included_items_data)
189
- Isomorfeus.raise_error "#{self.name}: #{node_class_name} with key #{node_key} could not be extracted from transport data!" unless node
189
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name} with key #{node_key} could not be extracted from transport data!") unless node
190
190
  from_to << node
191
191
  end
192
192
  end
@@ -470,18 +470,18 @@ module LucidData
470
470
  def instance_from_transport(instance_data, included_items_data)
471
471
  key = instance_data[self.name].keys.first
472
472
  revision = instance_data[self.name][key].key?('revision') ? instance_data[self.name][key]['revision'] : nil
473
- attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'] : nil
473
+ attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'].transform_keys!(&:to_sym) : nil
474
474
  edges_sids = instance_data[self.name][key].key?('edges') ? instance_data[self.name][key]['edges'] : []
475
475
  edges = []
476
476
  edges_sids.each do |sid|
477
477
  edge_class_name = sid[0]
478
478
  edge_key = sid[1]
479
- Isomorfeus.raise_error "#{self.name}: #{edge_class_name}: Not a valid LucidData class!" unless Isomorfeus.valid_data_class_name?(edge_class_name)
479
+ Isomorfeus.raise_error(message: "#{self.name}: #{edge_class_name}: Not a valid LucidData class!") unless Isomorfeus.valid_data_class_name?(edge_class_name)
480
480
  if included_items_data.key?(edge_class_name) && included_items_data[edge_class_name].key?(edge_key)
481
481
  edge_class = Isomorfeus.cached_data_class(edge_class_name)
482
- Isomorfeus.raise_error "#{self.name}: #{edge_class_name}: Cannot get class!" unless edge_class
482
+ Isomorfeus.raise_error(message: "#{self.name}: #{edge_class_name}: Cannot get class!") unless edge_class
483
483
  edge = edge_class.instance_from_transport({ edge_class_name => { edge_key => included_items_data[edge_class_name][edge_key] }}, included_items_data)
484
- Isomorfeus.raise_error "#{self.name}: #{edge_class_name} with key #{edge_key} could not be extracted from transport data!" unless edge
484
+ Isomorfeus.raise_error(message: "#{self.name}: #{edge_class_name} with key #{edge_key} could not be extracted from transport data!") unless edge
485
485
  edges << edge
486
486
  end
487
487
  end
@@ -392,23 +392,27 @@ module LucidData
392
392
  def instance_from_transport(instance_data, included_items_data)
393
393
  key = instance_data[self.name].keys.first
394
394
  revision = instance_data[self.name][key].key?('revision') ? instance_data[self.name][key]['revision'] : nil
395
- attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'] : nil
396
-
397
- nodes_sids = instance_data[self.name][key].key?('nodes') ? instance_data[self.name][key]['nodes'] : []
398
- edges_sids = instance_data[self.name][key].key?('edges') ? instance_data[self.name][key]['edges'] : []
399
-
400
- nodes_edges = [[],[]]
401
- [nodes_sids, edges_sids].each_with_index do |sids, nodes_edges_index|
402
- sids.each do |sid|
403
- node_class_name = sid[0]
404
- node_key = sid[1]
405
- Isomorfeus.raise_error "#{self.name}: #{node_class_name}: Not a valid LucidData class!" unless Isomorfeus.valid_data_class_name?(node_class_name)
406
- if included_items_data.key?(node_class_name) && included_items_data[node_class_name].key?(node_key)
407
- node_class = Isomorfeus.cached_data_class(node_class_name)
408
- Isomorfeus.raise_error "#{self.name}: #{node_class_name}: Cannot get class!" unless node_class
409
- node = node_class.instance_from_transport({ node_class_name => { node_key => included_items_data[node_class_name][node_key] }}, included_items_data)
410
- Isomorfeus.raise_error "#{self.name}: #{node_class_name} with key #{node_key} could not be extracted from transport data!" unless node
411
- nodes_edges[nodes_edges_index] << node
395
+ attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'].transform_keys!(&:to_sym) : nil
396
+
397
+ nodes_hash = instance_data[self.name][key].key?('nodes') ? instance_data[self.name][key]['nodes'] : {}
398
+ edges_hash = instance_data[self.name][key].key?('edges') ? instance_data[self.name][key]['edges'] : {}
399
+
400
+ nodes_edges = [{},{}]
401
+ [nodes_hash, edges_hash].each_with_index do |hash, hash_index|
402
+ hash.each do |name, value|
403
+ namsy = name.to_sym
404
+ nodes_edges[namsy] = []
405
+ hash[name].each do |sid|
406
+ node_class_name = sid[0]
407
+ node_key = sid[1]
408
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name}: Not a valid LucidData class!") unless Isomorfeus.valid_data_class_name?(node_class_name)
409
+ if included_items_data.key?(node_class_name) && included_items_data[node_class_name].key?(node_key)
410
+ node_class = Isomorfeus.cached_data_class(node_class_name)
411
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name}: Cannot get class!") unless node_class
412
+ node = node_class.instance_from_transport({ node_class_name => { node_key => included_items_data[node_class_name][node_key] }}, included_items_data)
413
+ Isomorfeus.raise_error(message: "#{self.name}: #{node_class_name} with key #{node_key} could not be extracted from transport data!") unless node
414
+ nodes_edges[namsy] << node
415
+ end
412
416
  end
413
417
  end
414
418
  end
@@ -287,7 +287,7 @@ module LucidData
287
287
  def instance_from_transport(instance_data, _included_items_data)
288
288
  key = instance_data[self.name].keys.first
289
289
  revision = instance_data[self.name][key].key?('revision') ? instance_data[self.name][key]['revision'] : nil
290
- attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'] : nil
290
+ attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'].transform_keys!(&:to_sym) : nil
291
291
  new(key: key, revision: revision, attributes: attributes)
292
292
  end
293
293
  end
@@ -45,8 +45,8 @@ module LucidData
45
45
  end
46
46
 
47
47
  def to_transport
48
- hash = _get_selected_attributes
49
- hash.merge!("revision" => revision) if revision
48
+ hash = { 'attributes' => _get_selected_attributes }
49
+ hash.merge!('revision' => revision) if revision
50
50
  result = { @class_name => { @key => hash }}
51
51
  result.deep_merge!(@class_name => { @previous_key => { new_key: @key}}) if @previous_key
52
52
  result
@@ -86,7 +86,7 @@ module LucidData
86
86
  end
87
87
 
88
88
  def _update_paths
89
- @_store_path = [:data_state, @class_name, @key]
89
+ @_store_path = [:data_state, @class_name, @key, :attributes]
90
90
  end
91
91
 
92
92
  def each(&block)
@@ -149,7 +149,7 @@ module LucidData
149
149
  def instance_from_transport(instance_data, _included_items_data)
150
150
  key = instance_data[self.name].keys.first
151
151
  revision = instance_data[self.name][key].key?('revision') ? instance_data[self.name][key]['revision'] : nil
152
- attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'] : nil
152
+ attributes = instance_data[self.name][key].key?('attributes') ? instance_data[self.name][key]['attributes'].transform_keys!(&:to_sym) : nil
153
153
  new(key: key, revision: revision, attributes: attributes)
154
154
  end
155
155
  end
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: 1.0.0.zeta13
4
+ version: 1.0.0.zeta14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-27 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 1.0.0.zeta13
117
+ version: 1.0.0.zeta14
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.0.0.zeta13
124
+ version: 1.0.0.zeta14
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: isomorfeus
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.0.0.zeta13
131
+ version: 1.0.0.zeta14
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.0.0.zeta13
138
+ version: 1.0.0.zeta14
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: opal-webpack-loader
141
141
  requirement: !ruby/object:Gem::Requirement