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
- #document ⇒ Object
-
#keep_reference_from_document! ⇒ Object
equivalent to NOKOGIRI_ROOT_NODE.
- #ruby_node ⇒ Object
- #ruby_node=(object) ⇒ Object
Instance Method Details
#document ⇒ Object
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_node ⇒ Object
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 |