lib/handsoap/xml_mason.rb in troelskn-handsoap-0.1.2 vs lib/handsoap/xml_mason.rb in troelskn-handsoap-0.2.0
- old
+ new
@@ -94,10 +94,13 @@
end
if block_given?
yield self
end
end
+ def document
+ @parent.respond_to?(:document) ? @parent.document : @parent
+ end
def full_name
@prefix.nil? ? @node_name : (@prefix + ":" + @node_name)
end
def append_child(node)
if value_node?
@@ -115,10 +118,11 @@
def set_attr(name, value)
full_name = parse_ns(name).join(":")
@attributes[name] = value
end
def find(name)
+ name = name.to_s if name.kind_of? Symbol
if @node_name == name || full_name == name
return self
end
@children.each do |node|
if node.respond_to? :find
@@ -129,9 +133,10 @@
end
end
return nil
end
def find_all(name)
+ name = name.to_s if name.kind_of? Symbol
result = []
if @node_name == name || full_name == name
result << self
end
@children.each do |node|