Class: SOAP::SOAPStruct
Overview
Constant Summary
Constants included
from SOAP
AttrActor, AttrActorName, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, AttrMustUnderstand, AttrMustUnderstandName, AttrOffset, AttrOffsetName, AttrPosition, AttrPositionName, AttrRoot, AttrRootName, Base64Literal, Charset, EleBody, EleBodyName, EleEnvelope, EleEnvelopeName, EleFault, EleFaultActor, EleFaultActorName, EleFaultCode, EleFaultCodeName, EleFaultDetail, EleFaultDetailName, EleFaultName, EleFaultString, EleFaultStringName, EleHeader, EleHeaderName, EncodingNamespace, EnvelopeNamespace, LiteralNamespace, MediaType, NS, NextActor, PropertyName, RPCRouter, RPCServerException, RPCUtils, SOAPNamespaceTag, SOAPProxy, TypeMap, VERSION, ValueArray, ValueArrayName, XSDNamespaceTag, XSINamespaceTag
Instance Attribute Summary
#qualified
Attributes included from SOAPType
#definedtype, #elename, #encodingstyle, #extraattr, #id, #parent, #position, #precedents, #root
Attributes inherited from XSD::NSDBase
#type
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Enumerable
#inject
Methods included from SOAPType
#inspect, #rootnode
inherited, #init, types
Constructor Details
#initialize(type = nil) ⇒ SOAPStruct
Returns a new instance of SOAPStruct.
443
444
445
446
447
448
|
# File 'lib/soap/baseData.rb', line 443
def initialize(type = nil)
super()
@type = type || XSD::QName::EMPTY
@array = []
@data = []
end
|
Class Method Details
.decode(elename, type) ⇒ Object
529
530
531
532
533
|
# File 'lib/soap/baseData.rb', line 529
def self.decode(elename, type)
s = SOAPStruct.new(type)
s.elename = elename
s
end
|
Instance Method Details
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
# File 'lib/soap/baseData.rb', line 462
def [](idx)
if idx.is_a?(Range)
@data[idx]
elsif idx.is_a?(Integer)
if (idx > @array.size)
raise ArrayIndexOutOfBoundsError.new('In ' << @type.name)
end
@data[idx]
else
if @array.include?(idx)
@data[@array.index(idx)]
else
nil
end
end
end
|
#[]=(idx, data) ⇒ Object
479
480
481
482
483
484
485
486
|
# File 'lib/soap/baseData.rb', line 479
def []=(idx, data)
if @array.include?(idx)
data.parent = self if data.respond_to?(:parent=)
@data[@array.index(idx)] = data
else
add(idx, data)
end
end
|
#add(name, value) ⇒ Object
458
459
460
|
# File 'lib/soap/baseData.rb', line 458
def add(name, value)
add_member(name, value)
end
|
515
516
517
518
519
520
521
|
# File 'lib/soap/baseData.rb', line 515
def each
idx = 0
while idx < @array.length
yield(@array[idx], @data[idx])
idx += 1
end
end
|
#key?(name) ⇒ Boolean
488
489
490
|
# File 'lib/soap/baseData.rb', line 488
def key?(name)
@array.include?(name)
end
|
492
493
494
|
# File 'lib/soap/baseData.rb', line 492
def members
@array
end
|
523
524
525
526
527
|
# File 'lib/soap/baseData.rb', line 523
def replace
members.each do |member|
self[member] = yield(self[member])
end
end
|
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
|
# File 'lib/soap/baseData.rb', line 496
def to_obj
hash = {}
proptype = {}
each do |k, v|
value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
case proptype[k]
when :single
hash[k] = [hash[k], value]
proptype[k] = :multi
when :multi
hash[k] << value
else
hash[k] = value
proptype[k] = :single
end
end
hash
end
|
450
451
452
453
454
455
456
|
# File 'lib/soap/baseData.rb', line 450
def to_s()
str = ''
self.each do |key, data|
str << "#{key}: #{data}\n"
end
str
end
|