/* * call-seq: * &(node_set) * * Set Intersection — Returns a new NodeSet containing nodes common to the two NodeSets. */ static VALUE intersection(VALUE self, VALUE rb_other) { xmlNodeSetPtr node_set; xmlNodeSetPtr other; if(!rb_obj_is_kind_of(rb_other, cNokogiriXmlNodeSet)) rb_raise(rb_eArgError, "node_set must be a Nokogiri::XML::NodeSet"); Data_Get_Struct(self, xmlNodeSet, node_set); Data_Get_Struct(rb_other, xmlNodeSet, other); return Nokogiri_wrap_xml_node_set(xmlXPathIntersection(node_set, other), rb_iv_get(self, "@document")); }