Class: WSDL::SOAP::ClassDefCreator

Inherits:
Object
  • Object
show all
Includes:
ClassDefCreatorSupport, XSD::CodeGen
Defined in:
lib/wsdl/soap/classDefCreator.rb

Constant Summary

Constants included from XSD::CodeGen

XSD::CodeGen::CONSTANTS, XSD::CodeGen::KEYWORDS

Instance Method Summary collapse

Methods included from ClassDefCreatorSupport

#assign_const, #basetype_mapped_class, #create_type_name, #dq, #dqname, #dump_method_signature, #mapped_class_basename, #mapped_class_name, #ndq, #nsym, #sym

Methods included from XSD::CodeGen::GenSupport

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

Constructor Details

#initialize(definitions, name_creator, modulepath = nil) ⇒ ClassDefCreator

Returns a new instance of ClassDefCreator.



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

def initialize(definitions, name_creator, modulepath = nil)
  @definitions = definitions
  @name_creator = name_creator
  @modulepath = modulepath
  @elements = definitions.collect_elements
  @elements.uniq!
  @attributes = definitions.collect_attributes
  @attributes.uniq!
  @simpletypes = definitions.collect_simpletypes
  @simpletypes.uniq!
  @complextypes = definitions.collect_complextypes
  @complextypes.uniq!
  @modelgroups = definitions.collect_modelgroups
  @modelgroups.uniq!
  @faulttypes = nil
  if definitions.respond_to?(:collect_faulttypes)
    @faulttypes = definitions.collect_faulttypes
  end
  @defined_const = {}
end

Instance Method Details

#dump(type = nil) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/wsdl/soap/classDefCreator.rb', line 45

def dump(type = nil)
  result = "require 'xsd/qname'\n"
  # cannot use @modulepath because of multiple classes
  if @modulepath
    result << "\n"
    result << modulepath_split(@modulepath).collect { |ele| "module #{ele}" }.join("; ")
    result << "\n\n"
  end
  str = dump_group(type)
  unless str.empty?
    result << "\n" unless result.empty?
    result << str
  end
  str = dump_complextype(type)
  unless str.empty?
    result << "\n" unless result.empty?
    result << str
  end
  str = dump_simpletype(type)
  unless str.empty?
    result << "\n" unless result.empty?
    result << str
  end
  str = dump_element(type)
  unless str.empty?
    result << "\n" unless result.empty?
    result << str
  end
  str = dump_attribute(type)
  unless str.empty?
    result << "\n" unless result.empty?
    result << str
  end
  if @modulepath
    result << "\n\n"
    result << modulepath_split(@modulepath).collect { |ele| "end" }.join("; ")
    result << "\n"
  end
  result
end