cxml-ruby 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/cxml/document_node.rb +3 -3
- data/lib/cxml/version.rb +1 -1
- data/spec/money_spec.rb +8 -0
- 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: 38b4bf64619173383fb1d6bbb76d1877bc70746752d884b6f9d79f967fcb70c0
|
4
|
+
data.tar.gz: 2f42907da9ebe23561a44f0a39ac1143e32660b465c5b19cea13dbbcd1328ee4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18ab3bad5fb8231724c14e29eb19c71ed1abdca1c9efd45832de27d46125070a705790a7813926f2f21273fdc010238de30d2405a251bcc28af389f5e075db76
|
7
|
+
data.tar.gz: 5b3206398d10770f12215be79a4f6877db2d6efafc9679e31cc08a756384247466c90cd061b3f044befbfc39e631f35cb0029f83792dce69220e9ca75e05347d
|
data/CHANGELOG.md
CHANGED
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
14
14
|
|
15
15
|
---
|
16
16
|
|
17
|
+
## [0.4.1] - 2020-04-20
|
18
|
+
### Changed
|
19
|
+
- Cast all node content values to strings before passing to Ox serializer.
|
20
|
+
|
17
21
|
## [0.4.0] - 2020-04-20
|
18
22
|
### Changed
|
19
23
|
- Return parsed nodes as plain string if they have no attributes and only string content.
|
data/lib/cxml/document_node.rb
CHANGED
@@ -54,7 +54,7 @@ module CXML
|
|
54
54
|
|
55
55
|
def to_element
|
56
56
|
element = ox_element
|
57
|
-
element << content if content
|
57
|
+
element << content.to_s if content
|
58
58
|
self.class.nodes.each do |child_node_name|
|
59
59
|
child_value = send(child_node_name)
|
60
60
|
if child_value.is_a?(Array)
|
@@ -88,12 +88,12 @@ module CXML
|
|
88
88
|
value_element = Ox::Element.new(camelize(name))
|
89
89
|
if value.is_a? Hash
|
90
90
|
value.each do |value_key, value_val|
|
91
|
-
next value_element << value_val if value_key == :content
|
91
|
+
next value_element << value_val.to_s if value_key == :content
|
92
92
|
|
93
93
|
value_element[value_key] = value_val
|
94
94
|
end
|
95
95
|
else
|
96
|
-
value_element << value
|
96
|
+
value_element << value.to_s
|
97
97
|
end
|
98
98
|
element << value_element
|
99
99
|
element
|
data/lib/cxml/version.rb
CHANGED
data/spec/money_spec.rb
CHANGED
@@ -38,5 +38,13 @@ describe CXML::Money do
|
|
38
38
|
it 'contains the required nodes' do
|
39
39
|
money_output_data[:currency].should_not be_empty
|
40
40
|
end
|
41
|
+
|
42
|
+
it 'can render non-string values' do
|
43
|
+
CXML::Document.new(message: { punch_out_order_message: {
|
44
|
+
punch_out_order_message_header: {
|
45
|
+
total: { money: { content: 12.3 } },
|
46
|
+
},
|
47
|
+
} }).to_xml
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|