roundtrip_xml 1.1.0 → 1.1.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/lib/roundtrip_xml/base_cleanroom.rb +8 -7
- data/lib/roundtrip_xml/roxml_builder.rb +2 -0
- 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: bec50a6f72fa1401f816ff1b8c1598aabba35c20
|
4
|
+
data.tar.gz: 416654af98b1fb5dda857586f0fc890b3bceb9f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab05c3b695450b7064225a2506b4c2ea6c7f754665469143f7062c534e246b980bbe915059e9a1f83853cc8bdab23c08511c5414cb41ae6062d922425c313ff1
|
7
|
+
data.tar.gz: 1e66cd0d3bb3670aac96c612106bc00e34efcd5dcf13380812aae4b7bba828fca5487771dbf69799902c3fb39558b6e072227b16dfe69a1089955ca9259ed3a6
|
@@ -15,22 +15,23 @@ class BaseCleanroom
|
|
15
15
|
get_el.attributes.each do |attr|
|
16
16
|
method_name = attr.accessor.to_sym
|
17
17
|
create_method(method_name) do |name = nil, &block|
|
18
|
+
corrected_attr = get_el.attributes.select{|a| a.accessor == attr.accessor}[0]
|
18
19
|
if !block.nil?
|
19
|
-
clazz = name ? @runtime.fetch(name) :
|
20
|
+
clazz = name ? @runtime.fetch(name) : corrected_attr.sought_type
|
20
21
|
value = expand(clazz, &block)
|
21
22
|
elsif name
|
22
23
|
value = name
|
23
24
|
else
|
24
|
-
return get_el.send(
|
25
|
+
return get_el.send(corrected_attr.accessor.to_sym)
|
25
26
|
end
|
26
27
|
|
27
|
-
if
|
28
|
-
array_attr = get_el.send(
|
29
|
-
array_attr ||=
|
28
|
+
if corrected_attr.array?
|
29
|
+
array_attr = get_el.send(corrected_attr.accessor.to_sym)
|
30
|
+
array_attr ||= corrected_attr.default
|
30
31
|
array_attr << value
|
31
|
-
get_el.send(
|
32
|
+
get_el.send(corrected_attr.setter.to_sym, array_attr)
|
32
33
|
else
|
33
|
-
get_el.send(
|
34
|
+
get_el.send(corrected_attr.setter.to_sym, value) unless get_el.send(corrected_attr.accessor.to_sym)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
self.class.send(:expose, method_name)
|
@@ -35,6 +35,8 @@ class RoxmlBuilder
|
|
35
35
|
child_class_name = name_to_sym child.name
|
36
36
|
add_accessor child_name, default_opts.merge({as: new_classes[child_class_name]}), @root
|
37
37
|
@generated_classes.merge!(new_classes)
|
38
|
+
elsif child.type == Nokogiri::XML::Node::TEXT_NODE && child.to_s.strip != ''
|
39
|
+
add_accessor name_to_sym(@root.name, true), {from: :content}, @root
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|