Class: VCDOM::XPath::Internal::NodeSetValue
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
#%, #*, #+, #-, #-@, #/, #<, #<=, #>, #>=, #is_command?, #is_expr?, #is_value?, #to_s
Constructor Details
Returns a new instance of NodeSetValue.
205
206
207
|
# File 'lib/vcdom/xpath/internal/value.rb', line 205
def initialize( *nodes )
@value = nodes
end
|
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
256
257
258
|
# File 'lib/vcdom/xpath/internal/value.rb', line 256
def value
@value
end
|
Instance Method Details
#<<(node) ⇒ Object
225
226
227
|
# File 'lib/vcdom/xpath/internal/value.rb', line 225
def <<( node )
@value << node
end
|
#<=>(val) ⇒ Object
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
# File 'lib/vcdom/xpath/internal/value.rb', line 318
def <=>( val )
case val.value_type
when :node_set
@value.each do |node1|
str1 = StringValue.new( node1.text_content )
val.each do |node2|
return BooleanValue.true if ( str1 <=> StringValue.new( node2.text_content ) ) == BooleanValue.true
end
end
return BooleanValue.false
when :number
raise "NOT SUPPORT"
when :string
raise "NOT SUPPORT"
when :boolean
return self.to_boolean_value <=> val
end
end
|
#==(val) ⇒ Object
比較されるべきオブジェクトの双方がノードセットである場合、比較は、2つのノードの文字列値について 比較を実行した結果が真であるようなノードが、1つ目のノードセットと2つ目のノードセットとにある場合に、 かつある場合にのみ、真ということになる。比較されるべきオブジェクトの一方がノードセットであり、 他方が数値である場合、比較は、比較されるべき数値と、number 関数を用いてノードの文字列値を数値に変換 した結果とについて比較を実行した結果が真であるようなノードが、ノードセットの中にある場合に、かつある 場合にのみ、真ということになる。比較されるべきオブジェクトの一方がノードセットであり、他方が文字列で ある場合、比較は、ノードの文字列値と他方の文字列とについて比較を実行した結果が真であるようなノードが、 ノードセットの中にある場合に、かつある場合にのみ、真ということになる。比較されるべきオブジェクトの一方が ノードセットであり、他方がブール値である場合、比較は、ブール値と、boolean 関数を用いてノードセット をブール値に変換した結果とについて比較を実行した結果が真である場合に、かつ真である場合にのみ、真ということになる。
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
# File 'lib/vcdom/xpath/internal/value.rb', line 276
def ==( val )
case val.value_type
when :node_set
@value.each do |node1|
str1 = StringValue.new( node1.text_content )
val.each do |node2|
return BooleanValue.true if ( str1 == StringValue.new( node2.text_content ) ) == BooleanValue.true
end
end
return BooleanValue.false
when :number
raise "NOT SUPPORT"
when :string
raise "NOT SUPPORT"
when :boolean
return val == self
end
end
|
#[](*args) ⇒ Object
222
223
224
|
# File 'lib/vcdom/xpath/internal/value.rb', line 222
def []( *args )
@value.[]( *args )
end
|
#each ⇒ Object
239
240
241
242
243
244
|
# File 'lib/vcdom/xpath/internal/value.rb', line 239
def each
@value.each do |v|
yield v
end
end
|
#each_with_index ⇒ Object
245
246
247
248
249
250
|
# File 'lib/vcdom/xpath/internal/value.rb', line 245
def each_with_index
@value.each_with_index do |v,i|
yield v,i
end
end
|
#length ⇒ Object
252
253
254
|
# File 'lib/vcdom/xpath/internal/value.rb', line 252
def length
@value.length
end
|
#neq?(val) ⇒ Boolean
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
# File 'lib/vcdom/xpath/internal/value.rb', line 297
def neq?( val )
case val.value_type
when :node_set
@value.each do |node1|
str1 = StringValue.new( node1.text_content )
val.each do |node2|
return BooleanValue.true if ( str1.neq? StringValue.new( node2.text_content ) ) == BooleanValue.true
end
end
return BooleanValue.false
when :number
raise "NOT SUPPORT"
when :string
raise "NOT SUPPORT"
when :boolean
return val.neq? self
end
end
|
#sort(document_order = true) ⇒ Object
229
230
231
232
233
234
235
236
237
|
# File 'lib/vcdom/xpath/internal/value.rb', line 229
def sort( document_order = true )
end
|
#to_boolean_value ⇒ Object
#to_number_value ⇒ Object
213
214
215
216
|
# File 'lib/vcdom/xpath/internal/value.rb', line 213
def to_number_value()
raise "NOT SUPPORT"
end
|
#to_string_value ⇒ Object
208
209
210
211
|
# File 'lib/vcdom/xpath/internal/value.rb', line 208
def to_string_value()
raise "NOT SUPPORT"
end
|
#value_type ⇒ Object
257
|
# File 'lib/vcdom/xpath/internal/value.rb', line 257
def value_type; :node_set end
|
#|(val) ⇒ Object
259
260
261
262
263
264
|
# File 'lib/vcdom/xpath/internal/value.rb', line 259
def |( val )
val.|(self) if val.value_type != :node_set
@value = @value + val.value
@value.uniq!
self
end
|