Method: Nokogiri::XML::NodeSet#dup

Defined in:
ext/nokogiri/xml_node_set.c

#dupObject Also known as: clone

Duplicate this NodeSet. Note that the Nodes contained in the NodeSet are not duplicated (similar to how Array and other Enumerable classes work).



56
57
58
59
60
61
62
63
64
65
66
# File 'ext/nokogiri/xml_node_set.c', line 56

static VALUE duplicate(VALUE self)
{
  xmlNodeSetPtr node_set;
  xmlNodeSetPtr dupl;

  Data_Get_Struct(self, xmlNodeSet, node_set);

  dupl = xmlXPathNodeSetMerge(NULL, node_set);

  return Nokogiri_wrap_xml_node_set(dupl, rb_iv_get(self, "@document"));
}