Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tweaks

  • Loading branch information...
commit 17dd4cdbdec0a7189d2d12f0fbd04e547242d670 1 parent 1b90966
@eugenebolshakov authored
Showing with 15 additions and 12 deletions.
  1. +15 −12 lib/lolsoap/hash_builder.rb
View
27 lib/lolsoap/hash_builder.rb
@@ -10,12 +10,10 @@ def initialize(node, type)
end
def output
- unless nil_value?
- if children.any?
- children_hash
- else
- content
- end
+ if children.any?
+ children_hash
+ else
+ content
end
end
@@ -26,11 +24,6 @@ def children
private
# @private
- def nil_value?
- !!node['nil'] && node.attributes['nil'].namespace.prefix == "xsi"
- end
-
- # @private
def children_hash
hash = {}
children.each do |child|
@@ -56,7 +49,17 @@ def children_hash
# @private
def content
- node.text.to_s
+ node.text.to_s unless nil_value?
+ end
+
+ # @private
+ def nil_value?
+ parent.search('./*[@xsi:nil=1]', 'xsi' => "http://www.w3.org/2001/XMLSchema-instance").include?(node)
+ end
+
+ # @private
+ def parent
+ node.ancestors.first
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.