Class: WSDL::SOAP::ClassNameCreator

Inherits:
Object
  • Object
show all
Includes:
XSD::CodeGen::GenSupport
Defined in:
lib/wsdl/soap/classNameCreator.rb

Instance Method Summary (collapse)

Methods included from XSD::CodeGen::GenSupport

capitalize, constant?, #format, keyword?, safeconstname, safeconstname?, safemethodname, safemethodname?, safevarname, safevarname?, uncapitalize

Constructor Details

- (ClassNameCreator) initialize

Returns a new instance of ClassNameCreator



20
21
22
# File 'lib/wsdl/soap/classNameCreator.rb', line 20

def initialize
  @classname = {}
end

Instance Method Details

- (Object) assign_name(qname, modulepath = nil)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/wsdl/soap/classNameCreator.rb', line 24

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

- (Object) check_classname(name)



45
46
47
48
49
# File 'lib/wsdl/soap/classNameCreator.rb', line 45

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