Class | SOAP::SOAPStruct
In: | soap/baseData.rb
Parent: | XSD::NSDBase

Compound datatypes.

### Methods

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

### Included Modules

SOAPCompoundtype Enumerable

### Public Class methods

decode(elename, type)

[Source]

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

new(type = nil)

[Source]

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

### Public Instance methods

[](idx)

[Source]

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

[Source]

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

[Source]

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

each() {|@array[idx], @data[idx]| ...}

[Source]

    # File soap/baseData.rb, line 472
      def each
        idx = 0
        while idx < @array.length
          yield(@array[idx], @data[idx])
          idx += 1
        end
      end

key?(name)

[Source]

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

members()

[Source]

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

replace() {|self[member]| ...}

[Source]

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

to_obj()

[Source]

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

[Source]

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

[Validate]