Module: Nokogiri::LibXML::XmlNodeSetMixin

Included in:
XmlNodeSet, XmlNodeSetCast
Defined in:
lib/nokogiri/ffi/structs/xml_node_set.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/nokogiri/ffi/structs/xml_node_set.rb', line 5

def self.included(base)
  base.class_eval do

    layout(
      :nodeNr,    :int,
      :nodeMax,   :int,
      :nodeTab,   :pointer
      )

  end
end

Instance Method Details

#documentObject



17
18
19
20
# File 'lib/nokogiri/ffi/structs/xml_node_set.rb', line 17

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

#nodeAt(index) ⇒ Object



22
23
24
# File 'lib/nokogiri/ffi/structs/xml_node_set.rb', line 22

def nodeAt(index)
  self[:nodeTab].get_pointer(LibXML.pointer_offset(index))
end

#nodeTabObject



26
27
28
# File 'lib/nokogiri/ffi/structs/xml_node_set.rb', line 26

def nodeTab
  self[:nodeTab].read_array_of_pointer(self[:nodeNr])
end

#nodeTab=(array) ⇒ Object



30
31
32
33
# File 'lib/nokogiri/ffi/structs/xml_node_set.rb', line 30

def nodeTab=(array)
  # TODO: do we need to check nodeMax and allocate more memory? probably.
  self[:nodeTab].write_array_of_pointer(array)
end