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, EleBody, EleBodyName, EleEnvelope, EleEnvelopeName, EleFault, EleFaultActor, EleFaultActorName, EleFaultCode, EleFaultCodeName, EleFaultDetail, EleFaultDetailName, EleFaultName, EleFaultString, EleFaultStringName, EleHeader, EleHeaderName, EncodingNamespace, EnvelopeNamespace, LiteralNamespace, MediaType, NextActor, PropertyName, SOAPNamespaceTag, SOAPProxy, TypeMap, ValueArray, ValueArrayName, Version, XSDNamespaceTag, XSINamespaceTag
Instance Attribute Summary
#qualified
Attributes included from SOAPType
#definedtype, #elename, #encodingstyle, #extraattr, #force_typed, #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
inherited, #init, types
Constructor Details
#initialize(type = nil) ⇒ SOAPStruct
Returns a new instance of SOAPStruct.
537
538
539
540
541
542
|
# File 'lib/soap/baseData.rb', line 537
def initialize(type = nil)
super()
@type = type || XSD::QName::EMPTY
@array = []
@data = []
end
|
Class Method Details
.decode(elename, type) ⇒ Object
632
633
634
635
636
|
# File 'lib/soap/baseData.rb', line 632
def self.decode(elename, type)
s = SOAPStruct.new(type)
s.elename = elename
s
end
|
Instance Method Details
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
|
# File 'lib/soap/baseData.rb', line 561
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
578
579
580
581
582
583
584
585
|
# File 'lib/soap/baseData.rb', line 578
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
552
553
554
555
556
557
558
559
|
# File 'lib/soap/baseData.rb', line 552
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
|
618
619
620
621
622
623
624
|
# File 'lib/soap/baseData.rb', line 618
def each
idx = 0
while idx < @array.length
yield(@array[idx], @data[idx])
idx += 1
end
end
|
#have_member ⇒ Object
595
596
597
|
# File 'lib/soap/baseData.rb', line 595
def have_member
!@array.empty?
end
|
#key?(name) ⇒ Boolean
587
588
589
|
# File 'lib/soap/baseData.rb', line 587
def key?(name)
@array.include?(name)
end
|
591
592
593
|
# File 'lib/soap/baseData.rb', line 591
def members
@array
end
|
626
627
628
629
630
|
# File 'lib/soap/baseData.rb', line 626
def replace
members.each do |member|
self[member] = yield(self[member])
end
end
|
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
|
# File 'lib/soap/baseData.rb', line 599
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
|
544
545
546
547
548
549
550
|
# File 'lib/soap/baseData.rb', line 544
def to_s
str = ''
self.each do |key, data|
str << "#{key}: #{data}\n"
end
str
end
|