Class: SOAP::Mapping::Object

Inherits:
Object
  • Object
show all
Includes:
SOAP::Marshallable
Defined in:
lib/soap/mapping/registry.rb

Overview

For anyType object: SOAP::Mapping::Object not ::Object

Instance Method Summary collapse

Constructor Details

#initializeObject

Returns a new instance of Object.



65
66
67
68
69
# File 'lib/soap/mapping/registry.rb', line 65

def initialize
  @__xmlele_type = {}
  @__xmlele = []
  @__xmlattr = {}
end

Instance Method Details

#[](qname) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/soap/mapping/registry.rb', line 84

def [](qname)
  unless qname.is_a?(XSD::QName)
    qname = XSD::QName.new(nil, qname)
  end
  @__xmlele.each do |k, v|
    return v if k == qname
  end
  # fallback
  @__xmlele.each do |k, v|
    return v if k.name == qname.name
  end
  nil
end

#[]=(qname, value) ⇒ Object



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/soap/mapping/registry.rb', line 98

def []=(qname, value)
  unless qname.is_a?(XSD::QName)
    qname = XSD::QName.new(nil, qname)
  end
  found = false
  @__xmlele.each do |pair|
    if pair[0] == qname
      found = true
      pair[1] = value
    end
  end
  unless found
    __define_attr_accessor(qname)
    @__xmlele << [qname, value]
  end
  @__xmlele_type[qname] = :single
end

#__add_xmlele_value(qname, value) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/soap/mapping/registry.rb', line 116

def __add_xmlele_value(qname, value)
  found = false
  @__xmlele.map! do |k, v|
    if k == qname
      found = true
      [k, __set_xmlele_value(k, v, value)]
    else
      [k, v]
    end
  end
  unless found
    __define_attr_accessor(qname)
    @__xmlele << [qname, value]
    @__xmlele_type[qname] = :single
  end
  value
end

#__xmlattrObject



76
77
78
# File 'lib/soap/mapping/registry.rb', line 76

def __xmlattr
  @__xmlattr
end

#__xmleleObject



80
81
82
# File 'lib/soap/mapping/registry.rb', line 80

def __xmlele
  @__xmlele
end

#inspectObject



71
72
73
74
# File 'lib/soap/mapping/registry.rb', line 71

def inspect
  sprintf("#<%s:0x%x%s>", self.class.name, __id__,
    @__xmlele.collect { |name, value| " #{name}=#{value.inspect}" }.join)
end