Module: SOAP::Marshal
- Defined in:
- lib/soap/marshal.rb
Constant Summary collapse
- MarshalMappingRegistry =
Trying xsd:dateTime data to be recovered as aTime.
Mapping::EncodedRegistry.new( :allow_original_mapping => true)
Class Method Summary collapse
- .dump(obj, io = nil) ⇒ Object
- .load(stream) ⇒ Object
- .marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil) ⇒ Object
- .unmarshal(stream, mapping_registry = MarshalMappingRegistry) ⇒ Object
Class Method Details
.dump(obj, io = nil) ⇒ Object
29 30 31 |
# File 'lib/soap/marshal.rb', line 29 def dump(obj, io = nil) marshal(obj, MarshalMappingRegistry, io) end |
.load(stream) ⇒ Object
33 34 35 |
# File 'lib/soap/marshal.rb', line 33 def load(stream) unmarshal(stream, MarshalMappingRegistry) end |
.marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/soap/marshal.rb', line 37 def marshal(obj, mapping_registry = MarshalMappingRegistry, io = nil) elename = Mapping.name2elename(obj.class.to_s) soap_obj = Mapping.obj2soap(obj, mapping_registry) body = SOAPBody.new body.add(elename, soap_obj) env = SOAPEnvelope.new(nil, body) SOAP::Processor.marshal(env, {}, io) end |
.unmarshal(stream, mapping_registry = MarshalMappingRegistry) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/soap/marshal.rb', line 46 def unmarshal(stream, mapping_registry = MarshalMappingRegistry) env = SOAP::Processor.unmarshal(stream) if env.nil? raise ArgumentError.new("Illegal SOAP marshal format.") end Mapping.soap2obj(env.body.root_node, mapping_registry) end |