Class: UPnP::Control::Service::Registry

Inherits:
SOAP::Mapping::EncodedRegistry
  • Object
show all
Defined in:
lib/UPnP/control/service.rb

Overview

UPnP relies on the client to do type conversions. This registry casts the SOAPString returned by the service into the real SOAP type so soap4r can make the conversion.

Instance Method Summary collapse

Instance Method Details

#soap2obj(node, klass = nil) ⇒ Object

If node is a simple type, cast it to the real type from the registered definition and super, otherwise just let EncodedRegistry do the work.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/UPnP/control/service.rb', line 76

def soap2obj(node, klass = nil)
  case node
  when XSD::XSDAnySimpleType then
    definition = find_node_definition node

    return super if definition.nil?

    new_class = definition.class_for
    new_node = new_class.new node.data

    return super(new_node, klass)
  when SOAP::SOAPStruct then
    return '' if node.members.empty?
  end

  super
end