roundtrip_xml 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d353e1be5b928524c4e94ad5caf990d279c2773
4
- data.tar.gz: 5ec3cb5d5b0d4d8f72c1befd6969b0eea45148a4
3
+ metadata.gz: bec50a6f72fa1401f816ff1b8c1598aabba35c20
4
+ data.tar.gz: 416654af98b1fb5dda857586f0fc890b3bceb9f5
5
5
  SHA512:
6
- metadata.gz: 779f7cd08f879da508b3b367136d01243284c75c43430b2666fad5ac7a56464ddecd7d3d1c26cac1aeca70b182bdec20c49da7e40294025038cddc63535241ac
7
- data.tar.gz: 525538e4d2d219cf81749fba0863dff4071be35991f6cf37a9ba8c861d5875f01754afd1966d048fc9b035683489e6e3e4e7ba0e19c78f6155168faa90164b82
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) : attr.sought_type
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(attr.accessor.to_sym)
25
+ return get_el.send(corrected_attr.accessor.to_sym)
25
26
  end
26
27
 
27
- if attr.array?
28
- array_attr = get_el.send(attr.accessor.to_sym)
29
- array_attr ||= attr.default
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(attr.setter.to_sym, array_attr)
32
+ get_el.send(corrected_attr.setter.to_sym, array_attr)
32
33
  else
33
- get_el.send(attr.setter.to_sym, value) unless get_el.send(attr.accessor.to_sym)
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roundtrip_xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Usick