delete (Nokogiri::XML::NodeSet)

    /*
     *  call-seq:
     *    delete(node)
     *
     *  Delete +node+ from the Nodeset, if it is a member. Returns the deleted node
     *  if found, otherwise returns nil.
     */
    static VALUE delete(VALUE self, VALUE rb_node)
    {
      xmlNodeSetPtr node_set ;
      xmlNodePtr node ;

      if(! rb_funcall(rb_node, rb_intern("is_a?"), 1, cNokogiriXmlNode))
        rb_raise(rb_eArgError, "node must be a Nokogiri::XML::Node");

      Data_Get_Struct(self, xmlNodeSet, node_set);
      Data_Get_Struct(rb_node, xmlNode, node);

      if (xmlXPathNodeSetContains(node_set, node)) {
        xmlXPathNodeSetDel(node_set, node);
        return rb_node ;
      }

      return Qnil ;
    }