SOAP::SOAPElement (Class)

In: soap/baseData.rb
Parent: Object

SOAPElement is not typed so it does not derive NSDBase.

Methods

[]   []=   add   decode   each   from_obj   key?   members   new   to_obj  

Attributes

elename  [RW] 
encodingstyle  [RW] 
extraattr  [RW] 
precedents  [R] 
qualified  [RW] 
text  [RW]  Text interface.

Included Modules

Public Class methods

[Source]

# File soap/baseData.rb, line 485
  def self.decode(elename)
    o = SOAPElement.new
    o.elename = elename
    o
  end

[Source]

# File soap/baseData.rb, line 491
  def self.from_obj(hash_or_string)
    o = SOAPElement.new(nil)
    if hash_or_string.is_a?(Hash)
      hash_or_string.each do |k, v|
        child = self.from_obj(v)
        child.elename = XSD::QName.new(nil, k)
        o.add(child)
      end
    else
      o.text = hash_or_string
    end
    o
  end

[Source]

# File soap/baseData.rb, line 419
  def initialize(elename, text = nil)
    if !elename.is_a?(XSD::QName)
      elename = XSD::QName.new(nil, elename)
    end
    @encodingstyle = LiteralNamespace
    @extraattr = {}
    @precedents = []

    @qualified = false
    @elename = elename

    @array = []
    @data = []
    @text = text
  end

Public Instance methods

[Source]

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

[Source]

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

Element interfaces.

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

# File soap/baseData.rb, line 467
  def to_obj
    if members.empty?
      @text
    else
      hash = {}
      each do |k, v|
        hash[k] = v.to_obj
      end
      hash
    end
  end

[Validate]