lutaml-model 0.7.1 → 0.7.3
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/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +49 -48
- data/Gemfile +4 -1
- data/README.adoc +791 -143
- data/RELEASE_NOTES.adoc +346 -0
- data/docs/custom_adapters.adoc +144 -0
- data/lib/lutaml/model/attribute.rb +17 -11
- data/lib/lutaml/model/config.rb +48 -42
- data/lib/lutaml/model/error/polymorphic_error.rb +7 -2
- data/lib/lutaml/model/format_registry.rb +41 -0
- data/lib/lutaml/model/hash/document.rb +11 -0
- data/lib/lutaml/model/hash/mapping.rb +19 -0
- data/lib/lutaml/model/hash/mapping_rule.rb +9 -0
- data/lib/lutaml/model/hash/standard_adapter.rb +17 -0
- data/lib/lutaml/model/hash/transform.rb +8 -0
- data/lib/lutaml/model/hash.rb +21 -0
- data/lib/lutaml/model/json/document.rb +11 -0
- data/lib/lutaml/model/json/mapping.rb +19 -0
- data/lib/lutaml/model/json/mapping_rule.rb +9 -0
- data/lib/lutaml/model/{json_adapter → json}/multi_json_adapter.rb +4 -5
- data/lib/lutaml/model/{json_adapter/standard_json_adapter.rb → json/standard_adapter.rb} +5 -3
- data/lib/lutaml/model/json/transform.rb +8 -0
- data/lib/lutaml/model/json.rb +21 -0
- data/lib/lutaml/model/key_value_document.rb +27 -0
- data/lib/lutaml/model/mapping/key_value_mapping.rb +8 -4
- data/lib/lutaml/model/mapping/mapping.rb +13 -0
- data/lib/lutaml/model/mapping/mapping_rule.rb +7 -6
- data/lib/lutaml/model/serialization_adapter.rb +22 -0
- data/lib/lutaml/model/serialize.rb +146 -521
- data/lib/lutaml/model/services/logger.rb +54 -0
- data/lib/lutaml/model/services/transformer.rb +48 -0
- data/lib/lutaml/model/services.rb +2 -0
- data/lib/lutaml/model/toml/document.rb +11 -0
- data/lib/lutaml/model/toml/mapping.rb +27 -0
- data/lib/lutaml/model/toml/mapping_rule.rb +9 -0
- data/lib/lutaml/model/{toml_adapter → toml}/toml_rb_adapter.rb +3 -3
- data/lib/lutaml/model/toml/tomlib_adapter.rb +19 -0
- data/lib/lutaml/model/toml/transform.rb +8 -0
- data/lib/lutaml/model/toml.rb +30 -0
- data/lib/lutaml/model/transform/key_value_transform.rb +291 -0
- data/lib/lutaml/model/transform/xml_transform.rb +239 -0
- data/lib/lutaml/model/transform.rb +78 -0
- data/lib/lutaml/model/type/value.rb +6 -9
- data/lib/lutaml/model/uninitialized_class.rb +1 -1
- data/lib/lutaml/model/utils.rb +30 -0
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/model/{xml_adapter → xml}/builder/nokogiri.rb +2 -2
- data/lib/lutaml/model/{xml_adapter → xml}/builder/oga.rb +10 -10
- data/lib/lutaml/model/{xml_adapter → xml}/builder/ox.rb +1 -1
- data/lib/lutaml/model/{xml_adapter/xml_document.rb → xml/document.rb} +6 -7
- data/lib/lutaml/model/xml/element.rb +32 -0
- data/lib/lutaml/model/xml/mapping.rb +410 -0
- data/lib/lutaml/model/xml/mapping_rule.rb +141 -0
- data/lib/lutaml/model/xml/nokogiri_adapter.rb +232 -0
- data/lib/lutaml/model/{xml_adapter → xml}/oga/document.rb +1 -1
- data/lib/lutaml/model/{xml_adapter → xml}/oga/element.rb +3 -1
- data/lib/lutaml/model/xml/oga_adapter.rb +171 -0
- data/lib/lutaml/model/xml/ox_adapter.rb +215 -0
- data/lib/lutaml/model/xml/transform.rb +8 -0
- data/lib/lutaml/model/{xml_adapter → xml}/xml_attribute.rb +1 -1
- data/lib/lutaml/model/{xml_adapter → xml}/xml_element.rb +6 -3
- data/lib/lutaml/model/{xml_adapter → xml}/xml_namespace.rb +1 -1
- data/lib/lutaml/model/xml.rb +31 -0
- data/lib/lutaml/model/xml_adapter/element.rb +11 -25
- data/lib/lutaml/model/xml_adapter/nokogiri_adapter.rb +6 -223
- data/lib/lutaml/model/xml_adapter/oga_adapter.rb +13 -163
- data/lib/lutaml/model/xml_adapter/ox_adapter.rb +10 -207
- data/lib/lutaml/model/yaml/document.rb +10 -0
- data/lib/lutaml/model/yaml/mapping.rb +19 -0
- data/lib/lutaml/model/yaml/mapping_rule.rb +9 -0
- data/lib/lutaml/model/{yaml_adapter/standard_yaml_adapter.rb → yaml/standard_adapter.rb} +4 -3
- data/lib/lutaml/model/yaml/transform.rb +8 -0
- data/lib/lutaml/model/yaml.rb +21 -0
- data/lib/lutaml/model.rb +39 -4
- data/lutaml-model.gemspec +0 -4
- data/spec/benchmarks/xml_parsing_benchmark_spec.rb +4 -4
- data/spec/lutaml/model/cdata_spec.rb +7 -7
- data/spec/lutaml/model/custom_bibtex_adapter_spec.rb +598 -0
- data/spec/lutaml/model/custom_vobject_adapter_spec.rb +1226 -0
- data/spec/lutaml/model/group_spec.rb +18 -7
- data/spec/lutaml/model/hash/adapter_spec.rb +255 -0
- data/spec/lutaml/model/json_adapter_spec.rb +6 -6
- data/spec/lutaml/model/key_value_mapping_spec.rb +25 -1
- data/spec/lutaml/model/mixed_content_spec.rb +24 -24
- data/spec/lutaml/model/multiple_mapping_spec.rb +5 -5
- data/spec/lutaml/model/ordered_content_spec.rb +6 -6
- data/spec/lutaml/model/polymorphic_spec.rb +178 -0
- data/spec/lutaml/model/root_mappings_spec.rb +3 -3
- data/spec/lutaml/model/schema/xml_compiler_spec.rb +6 -6
- data/spec/lutaml/model/serializable_spec.rb +179 -103
- data/spec/lutaml/model/toml_adapter_spec.rb +6 -6
- data/spec/lutaml/model/toml_spec.rb +51 -0
- data/spec/lutaml/model/transformation_spec.rb +72 -15
- data/spec/lutaml/model/uninitialized_class_spec.rb +96 -0
- data/spec/lutaml/model/xml/namespace_spec.rb +57 -0
- data/spec/lutaml/model/xml/xml_element_spec.rb +1 -1
- data/spec/lutaml/model/xml_adapter/nokogiri_adapter_spec.rb +2 -2
- data/spec/lutaml/model/xml_adapter/oga_adapter_spec.rb +2 -2
- data/spec/lutaml/model/xml_adapter/ox_adapter_spec.rb +2 -2
- data/spec/lutaml/model/xml_adapter/xml_namespace_spec.rb +6 -6
- data/spec/lutaml/model/xml_adapter_spec.rb +6 -6
- data/spec/lutaml/model/xml_mapping_rule_spec.rb +3 -3
- data/spec/lutaml/model/xml_mapping_spec.rb +26 -14
- data/spec/lutaml/model/xml_spec.rb +63 -0
- data/spec/lutaml/model/yaml_adapter_spec.rb +3 -5
- data/spec/spec_helper.rb +3 -3
- metadata +64 -59
- data/lib/lutaml/model/json_adapter/json_document.rb +0 -20
- data/lib/lutaml/model/json_adapter/json_object.rb +0 -28
- data/lib/lutaml/model/loggable.rb +0 -15
- data/lib/lutaml/model/mapping/json_mapping.rb +0 -17
- data/lib/lutaml/model/mapping/toml_mapping.rb +0 -25
- data/lib/lutaml/model/mapping/xml_mapping.rb +0 -389
- data/lib/lutaml/model/mapping/xml_mapping_rule.rb +0 -139
- data/lib/lutaml/model/mapping/yaml_mapping.rb +0 -17
- data/lib/lutaml/model/mapping.rb +0 -14
- data/lib/lutaml/model/toml_adapter/toml_document.rb +0 -20
- data/lib/lutaml/model/toml_adapter/toml_object.rb +0 -28
- data/lib/lutaml/model/toml_adapter/tomlib_adapter.rb +0 -20
- data/lib/lutaml/model/toml_adapter.rb +0 -6
- data/lib/lutaml/model/yaml_adapter/yaml_document.rb +0 -20
- data/lib/lutaml/model/yaml_adapter/yaml_object.rb +0 -28
- data/lib/lutaml/model/yaml_adapter.rb +0 -8
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lutaml-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: base64
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: liquid
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: moxml
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,9 +61,11 @@ files:
|
|
89
61
|
- Gemfile
|
90
62
|
- LICENSE.md
|
91
63
|
- README.adoc
|
64
|
+
- RELEASE_NOTES.adoc
|
92
65
|
- Rakefile
|
93
66
|
- bin/console
|
94
67
|
- bin/setup
|
68
|
+
- docs/custom_adapters.adoc
|
95
69
|
- exe/lutaml-model
|
96
70
|
- lib/lutaml/model.rb
|
97
71
|
- lib/lutaml/model/attribute.rb
|
@@ -125,22 +99,27 @@ files:
|
|
125
99
|
- lib/lutaml/model/error/unknown_sequence_mapping_error.rb
|
126
100
|
- lib/lutaml/model/error/unknown_type_error.rb
|
127
101
|
- lib/lutaml/model/error/validation_error.rb
|
102
|
+
- lib/lutaml/model/format_registry.rb
|
103
|
+
- lib/lutaml/model/hash.rb
|
104
|
+
- lib/lutaml/model/hash/document.rb
|
105
|
+
- lib/lutaml/model/hash/mapping.rb
|
106
|
+
- lib/lutaml/model/hash/mapping_rule.rb
|
107
|
+
- lib/lutaml/model/hash/standard_adapter.rb
|
108
|
+
- lib/lutaml/model/hash/transform.rb
|
109
|
+
- lib/lutaml/model/json.rb
|
110
|
+
- lib/lutaml/model/json/document.rb
|
111
|
+
- lib/lutaml/model/json/mapping.rb
|
112
|
+
- lib/lutaml/model/json/mapping_rule.rb
|
113
|
+
- lib/lutaml/model/json/multi_json_adapter.rb
|
114
|
+
- lib/lutaml/model/json/standard_adapter.rb
|
115
|
+
- lib/lutaml/model/json/transform.rb
|
128
116
|
- lib/lutaml/model/json_adapter.rb
|
129
|
-
- lib/lutaml/model/
|
130
|
-
- lib/lutaml/model/json_adapter/json_object.rb
|
131
|
-
- lib/lutaml/model/json_adapter/multi_json_adapter.rb
|
132
|
-
- lib/lutaml/model/json_adapter/standard_json_adapter.rb
|
117
|
+
- lib/lutaml/model/key_value_document.rb
|
133
118
|
- lib/lutaml/model/liquefiable.rb
|
134
|
-
- lib/lutaml/model/loggable.rb
|
135
|
-
- lib/lutaml/model/mapping.rb
|
136
|
-
- lib/lutaml/model/mapping/json_mapping.rb
|
137
119
|
- lib/lutaml/model/mapping/key_value_mapping.rb
|
138
120
|
- lib/lutaml/model/mapping/key_value_mapping_rule.rb
|
121
|
+
- lib/lutaml/model/mapping/mapping.rb
|
139
122
|
- lib/lutaml/model/mapping/mapping_rule.rb
|
140
|
-
- lib/lutaml/model/mapping/toml_mapping.rb
|
141
|
-
- lib/lutaml/model/mapping/xml_mapping.rb
|
142
|
-
- lib/lutaml/model/mapping/xml_mapping_rule.rb
|
143
|
-
- lib/lutaml/model/mapping/yaml_mapping.rb
|
144
123
|
- lib/lutaml/model/mapping_hash.rb
|
145
124
|
- lib/lutaml/model/schema.rb
|
146
125
|
- lib/lutaml/model/schema/json_schema.rb
|
@@ -153,12 +132,21 @@ files:
|
|
153
132
|
- lib/lutaml/model/schema_location.rb
|
154
133
|
- lib/lutaml/model/sequence.rb
|
155
134
|
- lib/lutaml/model/serializable.rb
|
135
|
+
- lib/lutaml/model/serialization_adapter.rb
|
156
136
|
- lib/lutaml/model/serialize.rb
|
157
|
-
- lib/lutaml/model/
|
158
|
-
- lib/lutaml/model/
|
159
|
-
- lib/lutaml/model/
|
160
|
-
- lib/lutaml/model/
|
161
|
-
- lib/lutaml/model/
|
137
|
+
- lib/lutaml/model/services.rb
|
138
|
+
- lib/lutaml/model/services/logger.rb
|
139
|
+
- lib/lutaml/model/services/transformer.rb
|
140
|
+
- lib/lutaml/model/toml.rb
|
141
|
+
- lib/lutaml/model/toml/document.rb
|
142
|
+
- lib/lutaml/model/toml/mapping.rb
|
143
|
+
- lib/lutaml/model/toml/mapping_rule.rb
|
144
|
+
- lib/lutaml/model/toml/toml_rb_adapter.rb
|
145
|
+
- lib/lutaml/model/toml/tomlib_adapter.rb
|
146
|
+
- lib/lutaml/model/toml/transform.rb
|
147
|
+
- lib/lutaml/model/transform.rb
|
148
|
+
- lib/lutaml/model/transform/key_value_transform.rb
|
149
|
+
- lib/lutaml/model/transform/xml_transform.rb
|
162
150
|
- lib/lutaml/model/type.rb
|
163
151
|
- lib/lutaml/model/type/boolean.rb
|
164
152
|
- lib/lutaml/model/type/date.rb
|
@@ -175,24 +163,34 @@ files:
|
|
175
163
|
- lib/lutaml/model/utils.rb
|
176
164
|
- lib/lutaml/model/validation.rb
|
177
165
|
- lib/lutaml/model/version.rb
|
166
|
+
- lib/lutaml/model/xml.rb
|
167
|
+
- lib/lutaml/model/xml/builder/nokogiri.rb
|
168
|
+
- lib/lutaml/model/xml/builder/oga.rb
|
169
|
+
- lib/lutaml/model/xml/builder/ox.rb
|
170
|
+
- lib/lutaml/model/xml/document.rb
|
171
|
+
- lib/lutaml/model/xml/element.rb
|
172
|
+
- lib/lutaml/model/xml/mapping.rb
|
173
|
+
- lib/lutaml/model/xml/mapping_rule.rb
|
174
|
+
- lib/lutaml/model/xml/nokogiri_adapter.rb
|
175
|
+
- lib/lutaml/model/xml/oga/document.rb
|
176
|
+
- lib/lutaml/model/xml/oga/element.rb
|
177
|
+
- lib/lutaml/model/xml/oga_adapter.rb
|
178
|
+
- lib/lutaml/model/xml/ox_adapter.rb
|
179
|
+
- lib/lutaml/model/xml/transform.rb
|
180
|
+
- lib/lutaml/model/xml/xml_attribute.rb
|
181
|
+
- lib/lutaml/model/xml/xml_element.rb
|
182
|
+
- lib/lutaml/model/xml/xml_namespace.rb
|
178
183
|
- lib/lutaml/model/xml_adapter.rb
|
179
|
-
- lib/lutaml/model/xml_adapter/builder/nokogiri.rb
|
180
|
-
- lib/lutaml/model/xml_adapter/builder/oga.rb
|
181
|
-
- lib/lutaml/model/xml_adapter/builder/ox.rb
|
182
184
|
- lib/lutaml/model/xml_adapter/element.rb
|
183
185
|
- lib/lutaml/model/xml_adapter/nokogiri_adapter.rb
|
184
|
-
- lib/lutaml/model/xml_adapter/oga/document.rb
|
185
|
-
- lib/lutaml/model/xml_adapter/oga/element.rb
|
186
186
|
- lib/lutaml/model/xml_adapter/oga_adapter.rb
|
187
187
|
- lib/lutaml/model/xml_adapter/ox_adapter.rb
|
188
|
-
- lib/lutaml/model/
|
189
|
-
- lib/lutaml/model/
|
190
|
-
- lib/lutaml/model/
|
191
|
-
- lib/lutaml/model/
|
192
|
-
- lib/lutaml/model/
|
193
|
-
- lib/lutaml/model/
|
194
|
-
- lib/lutaml/model/yaml_adapter/yaml_document.rb
|
195
|
-
- lib/lutaml/model/yaml_adapter/yaml_object.rb
|
188
|
+
- lib/lutaml/model/yaml.rb
|
189
|
+
- lib/lutaml/model/yaml/document.rb
|
190
|
+
- lib/lutaml/model/yaml/mapping.rb
|
191
|
+
- lib/lutaml/model/yaml/mapping_rule.rb
|
192
|
+
- lib/lutaml/model/yaml/standard_adapter.rb
|
193
|
+
- lib/lutaml/model/yaml/transform.rb
|
196
194
|
- lutaml-model.gemspec
|
197
195
|
- sig/lutaml/model.rbs
|
198
196
|
- spec/address_spec.rb
|
@@ -220,12 +218,15 @@ files:
|
|
220
218
|
- spec/lutaml/model/choice_spec.rb
|
221
219
|
- spec/lutaml/model/collection_spec.rb
|
222
220
|
- spec/lutaml/model/comparable_model_spec.rb
|
221
|
+
- spec/lutaml/model/custom_bibtex_adapter_spec.rb
|
223
222
|
- spec/lutaml/model/custom_model_spec.rb
|
224
223
|
- spec/lutaml/model/custom_serialization_spec.rb
|
224
|
+
- spec/lutaml/model/custom_vobject_adapter_spec.rb
|
225
225
|
- spec/lutaml/model/defaults_spec.rb
|
226
226
|
- spec/lutaml/model/delegation_spec.rb
|
227
227
|
- spec/lutaml/model/enum_spec.rb
|
228
228
|
- spec/lutaml/model/group_spec.rb
|
229
|
+
- spec/lutaml/model/hash/adapter_spec.rb
|
229
230
|
- spec/lutaml/model/included_spec.rb
|
230
231
|
- spec/lutaml/model/inheritance_spec.rb
|
231
232
|
- spec/lutaml/model/json_adapter_spec.rb
|
@@ -251,6 +252,7 @@ files:
|
|
251
252
|
- spec/lutaml/model/serializable_validation_spec.rb
|
252
253
|
- spec/lutaml/model/simple_model_spec.rb
|
253
254
|
- spec/lutaml/model/toml_adapter_spec.rb
|
255
|
+
- spec/lutaml/model/toml_spec.rb
|
254
256
|
- spec/lutaml/model/transformation_spec.rb
|
255
257
|
- spec/lutaml/model/type/boolean_spec.rb
|
256
258
|
- spec/lutaml/model/type/date_spec.rb
|
@@ -263,12 +265,14 @@ files:
|
|
263
265
|
- spec/lutaml/model/type/time_spec.rb
|
264
266
|
- spec/lutaml/model/type/time_without_date_spec.rb
|
265
267
|
- spec/lutaml/model/type_spec.rb
|
268
|
+
- spec/lutaml/model/uninitialized_class_spec.rb
|
266
269
|
- spec/lutaml/model/utils_spec.rb
|
267
270
|
- spec/lutaml/model/validation_spec.rb
|
268
271
|
- spec/lutaml/model/value_map_spec.rb
|
269
272
|
- spec/lutaml/model/with_child_mapping_spec.rb
|
270
273
|
- spec/lutaml/model/xml/derived_attributes_spec.rb
|
271
274
|
- spec/lutaml/model/xml/namespace/nested_with_explicit_namespace_spec.rb
|
275
|
+
- spec/lutaml/model/xml/namespace_spec.rb
|
272
276
|
- spec/lutaml/model/xml/xml_element_spec.rb
|
273
277
|
- spec/lutaml/model/xml_adapter/nokogiri_adapter_spec.rb
|
274
278
|
- spec/lutaml/model/xml_adapter/oga_adapter_spec.rb
|
@@ -277,6 +281,7 @@ files:
|
|
277
281
|
- spec/lutaml/model/xml_adapter_spec.rb
|
278
282
|
- spec/lutaml/model/xml_mapping_rule_spec.rb
|
279
283
|
- spec/lutaml/model/xml_mapping_spec.rb
|
284
|
+
- spec/lutaml/model/xml_spec.rb
|
280
285
|
- spec/lutaml/model/yaml_adapter_spec.rb
|
281
286
|
- spec/lutaml/model_spec.rb
|
282
287
|
- spec/person_spec.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "json_object"
|
4
|
-
|
5
|
-
module Lutaml
|
6
|
-
module Model
|
7
|
-
module JsonAdapter
|
8
|
-
# Base class for JSON documents
|
9
|
-
class JsonDocument < JsonObject
|
10
|
-
def self.parse(json, _options = {})
|
11
|
-
raise NotImplementedError, "Subclasses must implement `parse`."
|
12
|
-
end
|
13
|
-
|
14
|
-
def to_json(*args)
|
15
|
-
raise NotImplementedError, "Subclasses must implement `to_json`."
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lutaml
|
4
|
-
module Model
|
5
|
-
module JsonAdapter
|
6
|
-
# Base class for JSON objects
|
7
|
-
class JsonObject
|
8
|
-
attr_reader :attributes
|
9
|
-
|
10
|
-
def initialize(attributes = {})
|
11
|
-
@attributes = attributes
|
12
|
-
end
|
13
|
-
|
14
|
-
def [](key)
|
15
|
-
@attributes[key]
|
16
|
-
end
|
17
|
-
|
18
|
-
def []=(key, value)
|
19
|
-
@attributes[key] = value
|
20
|
-
end
|
21
|
-
|
22
|
-
def to_h
|
23
|
-
@attributes
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Lutaml
|
2
|
-
module Model
|
3
|
-
module Loggable
|
4
|
-
def self.included(base)
|
5
|
-
base.define_method :warn_auto_handling do |name|
|
6
|
-
caller_file = File.basename(caller_locations(2, 1)[0].path)
|
7
|
-
caller_line = caller_locations(2, 1)[0].lineno
|
8
|
-
|
9
|
-
str = "[Lutaml::Model] WARN: `#{name}` is handled by default. No need to explecitly define at `#{caller_file}:#{caller_line}`"
|
10
|
-
warn(str)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative "key_value_mapping"
|
2
|
-
|
3
|
-
module Lutaml
|
4
|
-
module Model
|
5
|
-
class JsonMapping < KeyValueMapping
|
6
|
-
def initialize
|
7
|
-
super(:json)
|
8
|
-
end
|
9
|
-
|
10
|
-
def deep_dup
|
11
|
-
self.class.new.tap do |new_mapping|
|
12
|
-
new_mapping.instance_variable_set(:@mappings, duplicate_mappings)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require_relative "key_value_mapping"
|
2
|
-
|
3
|
-
module Lutaml
|
4
|
-
module Model
|
5
|
-
class TomlMapping < KeyValueMapping
|
6
|
-
def initialize
|
7
|
-
super(:toml)
|
8
|
-
end
|
9
|
-
|
10
|
-
def deep_dup
|
11
|
-
self.class.new.tap do |new_mapping|
|
12
|
-
new_mapping.instance_variable_set(:@mappings, duplicate_mappings)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def validate!(key, to, with, render_nil, render_empty)
|
17
|
-
super
|
18
|
-
|
19
|
-
if [true, :as_nil].include?(render_nil) || render_empty == :as_nil
|
20
|
-
raise IncorrectMappingArgumentsError, "nil values are not supported in toml format"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|