Module: Nokogiri::LibXML::CommonNode

Included in:
XmlAttribute, XmlDtd, XmlElement, XmlEntity, XmlNode, XmlNs
Defined in:
lib/nokogiri/ffi/structs/common_node.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#documentObject



5
6
7
8
# File 'lib/nokogiri/ffi/structs/common_node.rb', line 5

def document
  p = self[:doc]
  p.null? ? nil : LibXML::XmlDocumentCast.new(p)
end

#keep_reference_from_document!Object

equivalent to NOKOGIRI_ROOT_NODE



18
19
20
21
22
# File 'lib/nokogiri/ffi/structs/common_node.rb', line 18

def keep_reference_from_document! # equivalent to NOKOGIRI_ROOT_NODE
  doc = self.document
  raise "no document to add reference to" unless doc
  LibXML.xmlXPathNodeSetAdd(doc.unlinked_nodes, self)
end

#ruby_nodeObject



10
11
12
# File 'lib/nokogiri/ffi/structs/common_node.rb', line 10

def ruby_node
  self[:_private] != 0 ? ObjectSpace._id2ref(self[:_private]) : nil
end

#ruby_node=(object) ⇒ Object



14
15
16
# File 'lib/nokogiri/ffi/structs/common_node.rb', line 14

def ruby_node= object
  self[:_private] = object.object_id
end