yahm 0.0.3 → 0.0.4
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/lib/yahm/mapping.rb +1 -1
- data/lib/yahm/version.rb +1 -1
- data/spec/yahm/mapping_spec.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51df9587f13a715d60e914b1845b1817e2daa63f
|
|
4
|
+
data.tar.gz: cea8be105d9f5bed9a09468d6b78f94a2d1a7017
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6bc75ec528f51bbca72cf119dac7f073fe36e807576057ad8a8bd92b91dc30ad233839d2c8db167a5a7dfe4500ad42c4752f50f2d30430dc7424e6449542b21b
|
|
7
|
+
data.tar.gz: 6483e812df0b7afa52e00b6395716ff991b3ef1b20ef9da5589c94251b6b9ce7e305a1d7a86fe289828c8e55ead5668f4c6f468ee1c669fb0f530e9714762b27
|
data/lib/yahm/mapping.rb
CHANGED
|
@@ -53,7 +53,7 @@ class Yahm::Mapping
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
unless rule.last[:force_array].nil?
|
|
56
|
-
source_value = source_value.is_a?(Array) ? source_value : [source_value]
|
|
56
|
+
source_value = (source_value.is_a?(Array) ? source_value : [source_value]).compact
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
target_hash_parent_element = target_parent_path.inject(@translated_hash) { |hash, key| hash[key.to_sym] ||= {} }
|
data/lib/yahm/version.rb
CHANGED
data/spec/yahm/mapping_spec.rb
CHANGED
|
@@ -24,6 +24,7 @@ describe Yahm::Mapping do
|
|
|
24
24
|
_mapping.map "/record/languages", to: "/languages", force_array: true
|
|
25
25
|
_mapping.map "/record/authors", to: "/authors", split_by: ";"
|
|
26
26
|
_mapping.map "/record/version", to: "/version", default: 1
|
|
27
|
+
_mapping.map "/record/creators", to: "/creators", force_array: true # when source value is nil, there should be an empty array in the target hash
|
|
27
28
|
_mapping
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -52,7 +53,8 @@ describe Yahm::Mapping do
|
|
|
52
53
|
:count=>3,
|
|
53
54
|
:languages=>["ger"],
|
|
54
55
|
:authors=>["John Doe", "Jane Doe"],
|
|
55
|
-
:version=>1
|
|
56
|
+
:version=>1,
|
|
57
|
+
:creators=>[]
|
|
56
58
|
})
|
|
57
59
|
end
|
|
58
60
|
end
|