Class: WsdlMapper::Generation::Base
Abstract
- Inherits:
-
Object
- Object
- WsdlMapper::Generation::Base
show all
- Defined in:
- lib/wsdl_mapper/generation/base.rb
Overview
Instance Method Summary
(collapse)
Constructor Details
- (Base) initialize(context)
Returns a new instance of Base
10
11
12
13
14
|
# File 'lib/wsdl_mapper/generation/base.rb', line 10
def initialize(context)
byebug if context.nil?
@context = context
@logger = Logging.logger[self]
end
|
Instance Method Details
- (Object) append_file_for(type_name, result, &block)
41
42
43
44
|
# File 'lib/wsdl_mapper/generation/base.rb', line 41
def append_file_for(type_name, result, &block)
file_name = @context.path_for type_name
file file_name, result, mode: 'a', &block
end
|
- (Object) file(file_name, result, mode: 'w')
52
53
54
55
56
57
58
59
|
# File 'lib/wsdl_mapper/generation/base.rb', line 52
def file(file_name, result, mode: 'w')
File.open file_name, mode do |io|
f = get_formatter io
yield f
end
result.files << file_name
end
|
- (Object) file_for(type_name, result, &block)
36
37
38
39
|
# File 'lib/wsdl_mapper/generation/base.rb', line 36
def file_for(type_name, result, &block)
file_name = @context.path_for type_name
file file_name, result, &block
end
|
- (Object) generate_name(name, suffix = '')
16
17
18
19
20
21
22
23
24
|
# File 'lib/wsdl_mapper/generation/base.rb', line 16
def generate_name(name, suffix = '')
return 'nil' if name.nil?
ns = name.ns.inspect
local_name = (name.name + suffix).inspect
"[#{ns}, #{local_name}]"
end
|
61
62
63
|
# File 'lib/wsdl_mapper/generation/base.rb', line 61
def get_formatter(io)
@formatter_factory.new io
end
|
- (Object) get_module_names(type)
65
66
67
|
# File 'lib/wsdl_mapper/generation/base.rb', line 65
def get_module_names(type)
type.parents.reverse.map &:module_name
end
|
- (Object) get_type_name(type)
26
27
28
29
30
31
32
33
34
|
# File 'lib/wsdl_mapper/generation/base.rb', line 26
def get_type_name(type)
if type.name
type
elsif type.containing_element
@namer.get_inline_type type.containing_element
elsif type.containing_property
@namer.get_inline_type type.containing_property
end
end
|
- (Object) type_file_for(type_name, result) {|| ... }
47
48
49
50
|
# File 'lib/wsdl_mapper/generation/base.rb', line 47
def type_file_for(type_name, result, &block)
file_for type_name, result, &block
result.add_type type_name
end
|