Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1982

Show
Ignore:
Timestamp:
09/23/07 23:54:45 (1 year ago)
Author:
nahi
Message:
  • cache the result of Mapping.const_from_name when the method is called with lenient = false.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/mapping/literalregistry.rb

    r1972 r1982  
    321321      define_xmlattr(obj) 
    322322      attributes.each do |qname, class_name| 
    323         attr = node.extraattr[qname] 
    324         next if attr.nil? 
    325         child = attr 
     323        child = node.extraattr[qname] 
     324        next if child.nil? 
    326325        if class_name 
    327326          klass = Mapping.class_from_name(class_name) 
    328327          if klass.include?(::SOAP::SOAPBasetype) 
    329             child = klass.to_data(attr
     328            child = klass.to_data(child
    330329          end 
    331330        end 
  • trunk/lib/soap/mapping/mapping.rb

    r1979 r1982  
    227227 
    228228  def self.class_from_name(name, lenient = false) 
    229     const = const_from_name(name, lenient) 
     229    unless lenient 
     230      const = const_from_name_nonlenient(name) 
     231    else 
     232      const = const_from_name(name, true) 
     233    end 
    230234    if const.is_a?(::Class) 
    231235      const 
     
    236240 
    237241  def self.module_from_name(name, lenient = false) 
    238     const = const_from_name(name, lenient) 
     242    unless lenient 
     243      const = const_from_name_nonlenient(name) 
     244    else 
     245      const = const_from_name(name, true) 
     246    end 
    239247    if const.is_a?(::Module) 
    240248      const 
    241249    else 
    242250      nil 
     251    end 
     252  end 
     253 
     254  def self.const_from_name_nonlenient(name) 
     255    if Thread.current[:SOAPMapping] 
     256      Thread.current[:SOAPMapping][:ConstFromName][name] ||= 
     257        const_from_name(name) 
     258    else 
     259      const_from_name(name) 
    243260    end 
    244261  end 
     
    572589        data[:SafeMethodName] = {} 
    573590        data[:SafeVarName] = {} 
     591        data[:ConstFromName] = {} 
    574592        yield 
    575593      end