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, SOAPProxy, TypeMap, VERSION, ValueArray, ValueArrayName
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.
536
537
538
539
540
541
|
# File 'lib/soap/baseData.rb', line 536
def initialize(type = nil)
super()
@type = type || XSD::QName::EMPTY
@array = []
@data = []
end
|
Class Method Details
.decode(elename, type) ⇒ Object
631
632
633
634
635
|
# File 'lib/soap/baseData.rb', line 631
def self.decode(elename, type)
s = SOAPStruct.new(type)
s.elename = elename
s
end
|
Instance Method Details
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
|
# File 'lib/soap/baseData.rb', line 560
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
577
578
579
580
581
582
583
584
|
# File 'lib/soap/baseData.rb', line 577
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
551
552
553
554
555
556
557
558
|
# File 'lib/soap/baseData.rb', line 551
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
|
617
618
619
620
621
622
623
|
# File 'lib/soap/baseData.rb', line 617
def each
idx = 0
while idx < @array.length
yield(@array[idx], @data[idx])
idx += 1
end
end
|
#have_member ⇒ Object
594
595
596
|
# File 'lib/soap/baseData.rb', line 594
def have_member
!@array.empty?
end
|
#key?(name) ⇒ Boolean
586
587
588
|
# File 'lib/soap/baseData.rb', line 586
def key?(name)
@array.include?(name)
end
|
590
591
592
|
# File 'lib/soap/baseData.rb', line 590
def members
@array
end
|
625
626
627
628
629
|
# File 'lib/soap/baseData.rb', line 625
def replace
members.each do |member|
self[member] = yield(self[member])
end
end
|
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
|
# File 'lib/soap/baseData.rb', line 598
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
|
543
544
545
546
547
548
549
|
# File 'lib/soap/baseData.rb', line 543
def to_s
str = ''
self.each do |key, data|
str << "#{key}: #{data}\n"
end
str
end
|