Method: Nokogiri::XML::Node#dup

Defined in:
lib/nokogiri/xml/node.rb

#dup(level = 1, new_parent_doc = document) ⇒ Object

:call-seq:

dup → Nokogiri::XML::Node
dup(level) → Nokogiri::XML::Node
dup(level, new_parent_doc) → Nokogiri::XML::Node

Duplicate this node.

Parameters
  • level (optional Integer). 0 is a shallow copy, 1 (the default) is a deep copy.

  • new_parent_doc (optional Nokogiri::XML::Document) The new node’s parent Document. Defaults to the the Document of the current node.

Returns

The new Nokogiri::XML::Node



144
145
146
# File 'lib/nokogiri/xml/node.rb', line 144

def dup(level = 1, new_parent_doc = document)
  super().initialize_copy_with_args(self, level, new_parent_doc)
end