Class: Saxon::XPath::VariableDeclaration

Inherits:
Object
  • Object
show all
Defined in:
lib/saxon/xpath/variable_declaration.rb

Overview

Represents an XPath variable declaration in the static context of a compiled XPath, providing an idiomatic Ruby way to deal with these.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(qname, sequence_type) ⇒ VariableDeclaration

Returns a new instance of VariableDeclaration.

Parameters:



16
17
18
19
# File 'lib/saxon/xpath/variable_declaration.rb', line 16

def initialize(qname, sequence_type)
  @qname = qname
  @sequence_type = sequence_type || Saxon.SequenceType('item()*')
end

Instance Attribute Details

#qnameSaxon::QName (readonly)

Returns:



9
10
11
# File 'lib/saxon/xpath/variable_declaration.rb', line 9

def qname
  @qname
end

#sequence_typeSaxon::SequenceType (readonly)

Returns:



11
12
13
# File 'lib/saxon/xpath/variable_declaration.rb', line 11

def sequence_type
  @sequence_type
end

Instance Method Details

#==(other) ⇒ Boolean

VariableDeclarations compare equal if their qname and sequence_type are equal

Parameters:

  • other (Saxon::VariableDeclaration)

Returns:

  • (Boolean)


24
25
26
# File 'lib/saxon/xpath/variable_declaration.rb', line 24

def ==(other)
  VariableDeclaration === other && qname == other.qname && sequence_type == other.sequence_type
end

#compiler_argsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

return the arguments XPathCompiler.declareVariable expects



30
31
32
# File 'lib/saxon/xpath/variable_declaration.rb', line 30

def compiler_args
  [qname.to_java, sequence_type.item_type.to_java, sequence_type.occurrence_indicator.to_java]
end