Class: SOAP::Mapping::TypedStructFactory_

Inherits:
Factory show all
Defined in:
lib/soap/mapping/factory.rb

Instance Method Summary collapse

Methods inherited from Factory

#initialize, #setiv2obj, #setiv2soap

Methods included from TraverseSupport

#mark_marshalled_obj, #mark_unmarshalled_obj

Constructor Details

This class inherits a constructor from SOAP::Mapping::Factory

Instance Method Details

#obj2soap(soap_class, obj, info, map) ⇒ Object



310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/soap/mapping/factory.rb', line 310

def obj2soap(soap_class, obj, info, map)
  type = info[:type] || info[0]
  soap_obj = soap_class.new(type)
  mark_marshalled_obj(obj, soap_obj)
  if obj.class <= SOAP::Marshallable
    setiv2soap(soap_obj, obj, map)
  else
    # allow to serialize an instance of unmarked class
    setiv2soap(soap_obj, obj, map)
  end
  soap_obj
end

#soap2obj(obj_class, node, info, map) ⇒ Object



323
324
325
326
327
328
329
330
331
332
# File 'lib/soap/mapping/factory.rb', line 323

def soap2obj(obj_class, node, info, map)
  type = info[:type] || info[0]
  unless node.type == type
    return false
  end
  obj = Mapping.create_empty_object(obj_class)
  mark_unmarshalled_obj(node, obj)
  setiv2obj(obj, node, map)
  return true, obj
end