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

#basetype_mapped_class, #create_class_name, #dq, #dqname, #dump_method_signature, #ndq, #nsym, #sym

Methods included from XSD::CodeGen::GenSupport

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

Constructor Details

#initialize(definitions, modulepath = nil) ⇒ ClassDefCreator

Returns a new instance of ClassDefCreator.


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/wsdl/soap/classDefCreator.rb', line 22

def initialize(definitions, modulepath = nil)
  @definitions = definitions
  @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!
  @faulttypes = nil
  if definitions.respond_to?(:collect_faulttypes)
    @faulttypes = definitions.collect_faulttypes
  end
end

Instance Method Details

#dump(type = nil) ⇒ Object


39
40
41
42
43
44
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
# File 'lib/wsdl/soap/classDefCreator.rb', line 39

def dump(type = nil)
  result = "require 'xsd/qname'\n"
  if @modulepath
    result << "\n"
    result << @modulepath.collect { |ele| "module #{ele}" }.join("; ")
    result << "\n\n"
  end
  if type
    result << dump_classdef(type.name, type)
  else
    str = dump_complextype
    unless str.empty?
      result << "\n" unless result.empty?
      result << str
    end
    str = dump_simpletype
    unless str.empty?
      result << "\n" unless result.empty?
      result << str
    end
    str = dump_element
    unless str.empty?
      result << "\n" unless result.empty?
      result << str
    end
    str = dump_attribute
    unless str.empty?
      result << "\n" unless result.empty?
      result << str
    end
  end
  if @modulepath
    result << "\n\n"
    result << @modulepath.collect { |ele| "end" }.join("; ")
    result << "\n"
  end
  result
end