Class: SOAP::SOAPStruct
Overview
Constant Summary
Constants included
from SOAP
AttrActor, AttrActorName, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, AttrHref, AttrHrefName, AttrId, AttrIdName, 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, NextActor, PropertyName, RPCRouter, RPCServerException, RPCUtils, SOAPGenerator, SOAPProxy, TypeMap, VERSION, ValueArray, ValueArrayName
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 SOAPType
#inspect, #rootnode
Methods included from Enumerable
#inject
inherited, #init, types
Constructor Details
#initialize(type = nil) ⇒ SOAPStruct
Returns a new instance of SOAPStruct.
534
535
536
537
538
539
|
# File 'lib/soap/baseData.rb', line 534
def initialize(type = nil)
super()
@type = type || XSD::QName::EMPTY
@array = []
@data = []
end
|
Class Method Details
.decode(elename, type) ⇒ Object
629
630
631
632
633
|
# File 'lib/soap/baseData.rb', line 629
def self.decode(elename, type)
s = SOAPStruct.new(type)
s.elename = elename
s
end
|
Instance Method Details
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
|
# File 'lib/soap/baseData.rb', line 558
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
575
576
577
578
579
580
581
582
|
# File 'lib/soap/baseData.rb', line 575
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
549
550
551
552
553
554
555
556
|
# File 'lib/soap/baseData.rb', line 549
def add(name, value)
value = SOAPNil.new if value.nil?
@array.push(name)
value.elename = value.elename.dup_name(name)
@data.push(value)
value.parent = self if value.respond_to?(:parent=)
value
end
|
615
616
617
618
619
620
621
|
# File 'lib/soap/baseData.rb', line 615
def each
idx = 0
while idx < @array.length
yield(@array[idx], @data[idx])
idx += 1
end
end
|
#have_member ⇒ Object
592
593
594
|
# File 'lib/soap/baseData.rb', line 592
def have_member
!@array.empty?
end
|
#key?(name) ⇒ Boolean
584
585
586
|
# File 'lib/soap/baseData.rb', line 584
def key?(name)
@array.include?(name)
end
|
588
589
590
|
# File 'lib/soap/baseData.rb', line 588
def members
@array
end
|
623
624
625
626
627
|
# File 'lib/soap/baseData.rb', line 623
def replace
members.each do |member|
self[member] = yield(self[member])
end
end
|
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
|
# File 'lib/soap/baseData.rb', line 596
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
|
541
542
543
544
545
546
547
|
# File 'lib/soap/baseData.rb', line 541
def to_s
str = ''
self.each do |key, data|
str << "#{key}: #{data}\n"
end
str
end
|