Sha256: 54cdf3ec38452f14ae1b786e2740ee8d277510d06563d0ca311932ea071c512b

Contents?: true

Size: 1.26 KB

Versions: 33

Compression:

Stored size: 1.26 KB

Contents

# WSDL4R - Class name creator.
# Copyright (C) 2000-2007  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.

# This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later version.


require 'soap/mapping/typeMap'
require 'xsd/codegen/gensupport'


module WSDL
module SOAP


class ClassNameCreator
  include XSD::CodeGen::GenSupport

  def initialize
    @classname = {}
  end

  def assign_name(qname, modulepath = nil)
    key = [modulepath, qname]
    unless @classname.key?(key)
      if klass = ::SOAP::TypeMap[qname]
        name =
          ::SOAP::Mapping::DefaultRegistry.find_mapped_obj_class(klass).name
      else
        name = safeconstname(qname.name)
        if modulepath
          name = [modulepath, name].join('::')
        end
        while @classname.value?(name)
          name += '_'
        end
        check_classname(name)
      end
      @classname[key] = name.freeze
    end
    @classname[key]
  end

  def check_classname(name)
    if Object.constants.include?(name)
      warn("created definition re-opens an existing toplevel class: #{name}.  consider to use --module_path option of wsdl2ruby.rb")
    end
  end
end


end
end

Version data entries

33 entries across 33 versions & 15 rubygems

Version Path
mumboe-soap4r-1.6.0.pre.beta lib/wsdl/soap/classNameCreator.rb
DefV-soap4r-1.5.8.2 lib/wsdl/soap/classNameCreator.rb
mumboe-soap4r-1.5.8.7 lib/wsdl/soap/classNameCreator.rb
soap2r-1.5.8 lib/wsdl/soap/classNameCreator.rb
teo-soap4r-1.5.9b lib/wsdl/soap/classNameCreator.rb
mumboe-soap4r-1.5.8.6 lib/wsdl/soap/classNameCreator.rb
soap4r-spox-1.6.0 lib/wsdl/soap/classNameCreator.rb
soap4r-r19-1.5.9 lib/wsdl/soap/classNameCreator.rb
mumboe-soap4r-1.5.8.5 lib/wsdl/soap/classNameCreator.rb
soap4r-ruby1.9-2.0.5 lib/wsdl/soap/classNameCreator.rb
soap4r-sgonyea-1.6.0 lib/wsdl/soap/classNameCreator.rb
soap4r-straightjacket-1.5.9 lib/wsdl/soap/classNameCreator.rb
soap4r-straightjacket-1.5.8 lib/wsdl/soap/classNameCreator.rb
soap4r-ruby1.9-2.0.3 lib/wsdl/soap/classNameCreator.rb
soap4r-ruby1.9-2.0.2 lib/wsdl/soap/classNameCreator.rb
soap4r-ruby1.9-2.0.1 lib/wsdl/soap/classNameCreator.rb
mumboe-soap4r-1.5.8.4 lib/wsdl/soap/classNameCreator.rb
railsware-soap4r-1.5.8.1 lib/wsdl/soap/classNameCreator.rb
soap4r-ruby1.9-2.0.0 lib/wsdl/soap/classNameCreator.rb
hands-soap4r-1.5.8.4 lib/wsdl/soap/classNameCreator.rb