Parent

Files

Class/Module Index [+]

Quicksearch

SOAP::Mapping::LiteralRegistry

Constants

MAPPING_OPT

Attributes

excn_handler_obj2soap[RW]
excn_handler_soap2obj[RW]

Public Class Methods

new() click to toggle source
# File lib/soap/mapping/literalregistry.rb, line 26
def initialize
  super()
  @excn_handler_obj2soap = nil
  @excn_handler_soap2obj = nil
end

Public Instance Methods

obj2soap(obj, qname, obj_class = nil) click to toggle source
# File lib/soap/mapping/literalregistry.rb, line 32
def obj2soap(obj, qname, obj_class = nil)
  soap_obj = nil
  if obj.is_a?(SOAPElement)
    soap_obj = obj
  else
    soap_obj = any2soap(obj, qname, obj_class)
  end
  return soap_obj if soap_obj
  if @excn_handler_obj2soap
    soap_obj = @excn_handler_obj2soap.call(obj) { |yield_obj|
      Mapping.obj2soap(yield_obj, nil, nil, MAPPING_OPT)
    }
    return soap_obj if soap_obj
  end
  raise MappingError.new("cannot map #{obj.class.name} as #{qname}")
end
soap2obj(node, obj_class = nil) click to toggle source

node should be a SOAPElement

# File lib/soap/mapping/literalregistry.rb, line 50
def soap2obj(node, obj_class = nil)
  cause = nil
  begin
    return any2obj(node, obj_class)
  rescue MappingError
    cause = $!
  end
  if @excn_handler_soap2obj
    begin
      return @excn_handler_soap2obj.call(node) { |yield_node|
          Mapping.soap2obj(yield_node, nil, nil, MAPPING_OPT)
        }
    rescue Exception
    end
  end
  raise MappingError.new("cannot map #{node.elename.name}/#{node.type.name} to Ruby object", cause)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.