SOAP::SOAPStruct (Class)

In: soap/baseData.rb
Parent: XSD::NSDBase

Compound datatypes.

Methods

[]   []=   add   decode   each   key?   members   new   replace   to_s  

Included Modules

SOAPCompoundtype Enumerable

Public Class methods

[Source]

# File soap/baseData.rb, line 391
  def self.decode(elename, type)
    s = SOAPStruct.new(type)
    s.elename = elename
    s
  end

[Source]

# File soap/baseData.rb, line 328
  def initialize(type = nil)
    super(type || XSD::QName.new)
    @array = []
    @data = []
  end

Public Instance methods

[Source]

# File soap/baseData.rb, line 346
  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

[Source]

# File soap/baseData.rb, line 363
  def []=(idx, data)
    if @array.include?(idx)
      @data[@array.index(idx)] = data
    else
      add(idx, data)
    end
  end

[Source]

# File soap/baseData.rb, line 342
  def add(name, value)
    add_member(name, value)
  end

[Source]

# File soap/baseData.rb, line 379
  def each
    for i in 0..(@array.length - 1)
      yield(@array[i], @data[i])
    end
  end

[Source]

# File soap/baseData.rb, line 371
  def key?(name)
    @array.include?(name)
  end

[Source]

# File soap/baseData.rb, line 375
  def members
    @array
  end

[Source]

# File soap/baseData.rb, line 385
  def replace
    members.each do |member|
      self[member] = yield(self[member])
    end
  end

[Source]

# File soap/baseData.rb, line 334
  def to_s()
    str = ''
    self.each do |key, data|
      str << "#{ key }: #{ data }\n"
    end
    str
  end

[Validate]