Added XML::NodeSet#+ and XML::NodeSet#to_a

This commit is contained in:
Yorick Peterse committed 2014-07-08 23:25:09 +02:00
1 parent 266c66569e
commit 9c661e1e60
2 files changed
+44

No files matched your search

+20
View File
@@ -159,6 +159,26 @@ module Oga
return @nodes[index]
end
##
# Converts the current set to an Array.
#
# @return [Array]
#
def to_a
return @nodes
end
##
# Creates a new set based on the current and the specified set. The newly
# created set does not inherit ownership rules of the current set.
#
# @param [Oga::XML::NodeSet] other
# @return [Oga::XML::NodeSet]
#
def +(other)
return self.class.new(to_a + other.to_a)
end
##
# Removes the current nodes from their owning set. The nodes are *not*
# removed from the current set.