Class: SOAP::Mapping::TypedArrayFactory_
- Defined in:
- lib/soap/mapping/factory.rb
Instance Method Summary collapse
-
#initialize(allow_original_mapping = false) ⇒ TypedArrayFactory_
constructor
A new instance of TypedArrayFactory_.
- #obj2soap(soap_class, obj, info, map) ⇒ Object
- #soap2obj(obj_class, node, info, map) ⇒ Object
Methods inherited from Factory
Methods included from TraverseSupport
#mark_marshalled_obj, #mark_unmarshalled_obj
Constructor Details
#initialize(allow_original_mapping = false) ⇒ TypedArrayFactory_
Returns a new instance of TypedArrayFactory_.
242 243 244 245 |
# File 'lib/soap/mapping/factory.rb', line 242 def initialize(allow_original_mapping = false) super() @allow_original_mapping = allow_original_mapping end |
Instance Method Details
#obj2soap(soap_class, obj, info, map) ⇒ Object
247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/soap/mapping/factory.rb', line 247 def obj2soap(soap_class, obj, info, map) if !@allow_original_mapping and !obj.instance_variables.empty? return nil end arytype = info[:type] || info[0] soap_obj = SOAPArray.new(ValueArrayName, 1, arytype) mark_marshalled_obj(obj, soap_obj) obj.each do |var| soap_obj.add(Mapping._obj2soap(var, map)) end soap_obj end |
#soap2obj(obj_class, node, info, map) ⇒ Object
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/soap/mapping/factory.rb', line 260 def soap2obj(obj_class, node, info, map) if node.rank > 1 return false end arytype = info[:type] || info[0] unless node.arytype == arytype return false end obj = Mapping.create_empty_object(obj_class) mark_unmarshalled_obj(node, obj) node.soap2array(obj) do |elem| elem ? Mapping._soap2obj(elem, map) : nil end return true, obj end |