Class: LibXMLJRuby::XML::XPath::Object

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/libxml-jruby/xml/xpath.rb

Defined Under Namespace

Classes: CustomNamespaceContext

Instance Method Summary collapse

Constructor Details

#initialize(expr, document, nslist = nil) ⇒ Object

Returns a new instance of Object.



9
10
11
12
# File 'lib/libxml-jruby/xml/xpath.rb', line 9

def initialize(expr, document, nslist = nil)
  @expr, @document = expr, document
  @nslist = nslist          
end

Instance Method Details

#[](index) ⇒ Object



34
35
36
# File 'lib/libxml-jruby/xml/xpath.rb', line 34

def [](index)
  set[index]
end

#each(&block) ⇒ Object



14
15
16
# File 'lib/libxml-jruby/xml/xpath.rb', line 14

def each(&block)
  set.each(&block)
end

#firstObject



22
23
24
# File 'lib/libxml-jruby/xml/xpath.rb', line 22

def first
  set.first
end

#lengthObject



18
19
20
# File 'lib/libxml-jruby/xml/xpath.rb', line 18

def length
  set.length
end

#setObject



30
31
32
# File 'lib/libxml-jruby/xml/xpath.rb', line 30

def set
  @set ||= LibXMLJRuby::XML::Node::Set.from_java(evaluate_expression)
end

#xpath_typeObject



26
27
28
# File 'lib/libxml-jruby/xml/xpath.rb', line 26

def xpath_type
  LibXMLJRuby::XML::XPath::NODESET
end