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_.
274 275 276 277 |
# File 'lib/soap/mapping/factory.rb', line 274 def initialize(allow_original_mapping = false) super() @allow_original_mapping = allow_original_mapping end |
Instance Method Details
#obj2soap(soap_class, obj, info, map) ⇒ Object
279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/soap/mapping/factory.rb', line 279 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
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/soap/mapping/factory.rb', line 292 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 |