class SOAP::SOAPStruct
Compound datatypes.
Public Class Methods
decode(elename, type)
click to toggle source
# File lib/soap/baseData.rb, line 629 def self.decode(elename, type) s = SOAPStruct.new(type) s.elename = elename s end
new(type = nil)
click to toggle source
Calls superclass method
SOAP::SOAPCompoundtype.new
# File lib/soap/baseData.rb, line 534 def initialize(type = nil) super() @type = type || XSD::QName::EMPTY @array = [] @data = [] end
Public Instance Methods
[](idx)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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
each() { |array, data| ... }
click to toggle source
# 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()
click to toggle source
# File lib/soap/baseData.rb, line 592 def have_member !@array.empty? end
key?(name)
click to toggle source
# File lib/soap/baseData.rb, line 584 def key?(name) @array.include?(name) end
members()
click to toggle source
# File lib/soap/baseData.rb, line 588 def members @array end
replace() { |self| ... }
click to toggle source
# File lib/soap/baseData.rb, line 623 def replace members.each do |member| self[member] = yield(self[member]) end end
to_obj()
click to toggle source
# 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
to_s()
click to toggle source
# File lib/soap/baseData.rb, line 541 def to_s str = '' self.each do |key, data| str << "#{key}: #{data}\n" end str end