Class: Saxon::XPath::VariableDeclaration
- Inherits:
-
Object
- Object
- Saxon::XPath::VariableDeclaration
- 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
- #item_type ⇒ Saxon::ItemType readonly
- #occurrences ⇒ net.sf.saxon.s9api.OccurrenceIndicator readonly
- #qname ⇒ Saxon::QName readonly
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
VariableDeclarations compare equal if their qname, item_type, and occurrences are equal.
- #compiler_args ⇒ Object private
-
#initialize(opts = {}) ⇒ VariableDeclaration
constructor
A new instance of VariableDeclaration.
Constructor Details
#initialize(opts = {}) ⇒ VariableDeclaration
Returns a new instance of VariableDeclaration.
17 18 19 20 21 |
# File 'lib/saxon/xpath/variable_declaration.rb', line 17 def initialize(opts = {}) raise VariableDeclarationError, opts.keys if opts.keys.length > 2 @qname = opts.fetch(:qname) @item_type, @occurrences = extract_type_decl(opts.reject { |k, v| k == :qname }) end |
Instance Attribute Details
#item_type ⇒ Saxon::ItemType (readonly)
11 12 13 |
# File 'lib/saxon/xpath/variable_declaration.rb', line 11 def item_type @item_type end |
#occurrences ⇒ net.sf.saxon.s9api.OccurrenceIndicator (readonly)
13 14 15 |
# File 'lib/saxon/xpath/variable_declaration.rb', line 13 def occurrences @occurrences end |
#qname ⇒ Saxon::QName (readonly)
9 10 11 |
# File 'lib/saxon/xpath/variable_declaration.rb', line 9 def qname @qname end |
Instance Method Details
#==(other) ⇒ Boolean
VariableDeclarations compare equal if their qname, item_type, and occurrences are equal
26 27 28 |
# File 'lib/saxon/xpath/variable_declaration.rb', line 26 def ==(other) VariableDeclaration === other && qname == other.qname && item_type == other.item_type && occurrences == other.occurrences end |
#compiler_args ⇒ Object
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.
31 32 33 |
# File 'lib/saxon/xpath/variable_declaration.rb', line 31 def compiler_args [qname.to_java, item_type.to_java, occurrences] end |