Class: Saxon::XDM::Array
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
#sequence_enum, #sequence_size
#append, #sequence_enum, #sequence_size
Constructor Details
#initialize(s9_xdm_array) ⇒ Array
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.
Returns a new instance of Array.
27
28
29
|
# File 'lib/saxon/xdm/array.rb', line 27
def initialize(s9_xdm_array)
@s9_xdm_array = s9_xdm_array
end
|
Class Method Details
.create(array) ⇒ Object
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/saxon/xdm/array.rb', line 8
def self.create(array)
case array
when S9API::XdmArray
new(array)
else
new(S9API::XdmArray.new(array.map { |item|
XDM.Value(item).to_java
}))
end
end
|
Instance Method Details
#==(other) ⇒ Boolean
Also known as:
eql?
50
51
52
53
54
|
# File 'lib/saxon/xdm/array.rb', line 50
def ==(other)
return false unless other.is_a?(XDM::Array)
return false if length != other.length
cached_array == other.to_a
end
|
#[](i) ⇒ Object
35
36
37
|
# File 'lib/saxon/xdm/array.rb', line 35
def [](i)
cached_array[i]
end
|
#each(&block) ⇒ Object
31
32
33
|
# File 'lib/saxon/xdm/array.rb', line 31
def each(&block)
cached_array.each(&block)
end
|
#hash ⇒ Object
62
63
64
|
# File 'lib/saxon/xdm/array.rb', line 62
def hash
@hash ||= cached_array.hash
end
|
#length ⇒ Object
Also known as:
size
39
40
41
|
# File 'lib/saxon/xdm/array.rb', line 39
def length
s9_xdm_array.arrayLength
end
|
#to_a ⇒ Object
56
57
58
|
# File 'lib/saxon/xdm/array.rb', line 56
def to_a
cached_array
end
|
#to_java ⇒ Object
66
67
68
|
# File 'lib/saxon/xdm/array.rb', line 66
def to_java
s9_xdm_array
end
|