In Files

  • soap/mapping/factory.rb

Class/Module Index [+]

Quicksearch

SOAP::Mapping::HashFactory_

Public Class Methods

new(allow_original_mapping = false) click to toggle source
 
               # File soap/mapping/factory.rb, line 304
def initialize(allow_original_mapping = false)
  super()
  @allow_original_mapping = allow_original_mapping
end
            

Public Instance Methods

obj2soap(soap_class, obj, info, map) click to toggle source
 
               # File soap/mapping/factory.rb, line 309
def obj2soap(soap_class, obj, info, map)
  if !@allow_original_mapping and !obj.instance_variables.empty?
    return nil
  end
  if !obj.default.nil? or
      (obj.respond_to?(:default_proc) and obj.default_proc)
    return nil
  end
  soap_obj = SOAPStruct.new(MapQName)
  mark_marshalled_obj(obj, soap_obj)
  obj.each do |key, value|
    elem = SOAPStruct.new
    elem.add("key", Mapping._obj2soap(key, map))
    elem.add("value", Mapping._obj2soap(value, map))
    # ApacheAxis allows only 'item' here.
    soap_obj.add("item", elem)
  end
  soap_obj
end
            
soap2obj(obj_class, node, info, map) click to toggle source
 
               # File soap/mapping/factory.rb, line 329
def soap2obj(obj_class, node, info, map)
  unless node.type == MapQName
    return false
  end
  if node.class == SOAPStruct and node.key?('default')
    return false
  end
  obj = Mapping.create_empty_object(obj_class)
  mark_unmarshalled_obj(node, obj)
  if node.class == SOAPStruct
    node.each do |key, value|
      obj[Mapping._soap2obj(value['key'], map)] =
        Mapping._soap2obj(value['value'], map)
    end
  else
    node.each do |value|
      obj[Mapping._soap2obj(value['key'], map)] =
        Mapping._soap2obj(value['value'], map)
    end
  end
  return true, obj
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus