openehr 2.0.0 → 2.0.1
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/README.rdoc +1 -1
- data/lib/openehr/rm/factory.rb +23 -6
- data/lib/openehr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5394d0db01d215484074adc3241b636ad480509bc4d7e64dd472d0b81891f3c4
|
|
4
|
+
data.tar.gz: eebc02803922cf2e24d974f1f2d410ed488d335f02f35db1c95f827bf8a2d6c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c00bcb8ba9313fcf1c0f2f15935efa92ac906e323fa67c2c6fbddd8350ecacd1111e958e22da2facbe7d77db0bcdbedd195bba17487516cb37ea351367849796
|
|
7
|
+
data.tar.gz: e077e96da7ee38994291a4b55f1cd2f6ef047e34017f9c8fd3213926c737860904a8d6ef90481f7f0b8794d01171fe6e28015a4ed67e39baf1b530150e06e447
|
data/README.rdoc
CHANGED
|
@@ -8,7 +8,7 @@ A Ruby implementation of the openEHR specifications
|
|
|
8
8
|
= Requirements
|
|
9
9
|
|
|
10
10
|
* Supports CRuby 3.1 or later.
|
|
11
|
-
* Developed with CRuby
|
|
11
|
+
* Developed with CRuby 4.0.6 on Linux; CI covers 3.1-3.4 and 4.0.
|
|
12
12
|
* Ruby 3.0 or earlier are no longer supported.
|
|
13
13
|
|
|
14
14
|
=Description
|
data/lib/openehr/rm/factory.rb
CHANGED
|
@@ -21,13 +21,30 @@ module OpenEHR
|
|
|
21
21
|
param.each_with_object({}) do |item, parameters|
|
|
22
22
|
key = item.shift
|
|
23
23
|
value = item.shift
|
|
24
|
-
|
|
25
|
-
parameters[key] = Factory.create(value[:_type], **value)
|
|
26
|
-
else
|
|
27
|
-
parameters[key] = value
|
|
28
|
-
end
|
|
24
|
+
parameters[key] = convert_value(value)
|
|
29
25
|
end
|
|
30
|
-
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
# A canonical-JSON attribute value is either a typed sub-object
|
|
31
|
+
# (Hash with _type), a List<...> of those (Array - openEHR RM
|
|
32
|
+
# multiplicity 0..*/1..* attributes, e.g. COMPOSITION.content,
|
|
33
|
+
# HISTORY.events, ITEM_TREE.items), or a plain value (String,
|
|
34
|
+
# Numeric, ...). Arrays recurse so nested multiplicities (e.g. a
|
|
35
|
+
# CLUSTER's own items) convert too; non-Hash array elements
|
|
36
|
+
# (there is no List<String>/List<Numeric> attribute in this RM,
|
|
37
|
+
# but doubles/pre-built objects show up in specs) pass through
|
|
38
|
+
# unchanged.
|
|
39
|
+
def convert_value(value)
|
|
40
|
+
if value.instance_of? Hash
|
|
41
|
+
Factory.create(value[:_type], **value)
|
|
42
|
+
elsif value.instance_of? Array
|
|
43
|
+
value.map { |element| convert_value(element) }
|
|
44
|
+
else
|
|
45
|
+
value
|
|
46
|
+
end
|
|
47
|
+
end
|
|
31
48
|
end
|
|
32
49
|
|
|
33
50
|
def build
|
data/lib/openehr/version.rb
CHANGED