Class: Soybean::InterfaceBuilder

Inherits:
Object
  • Object
show all
Includes:
WSDL::SOAP::ClassDefCreatorSupport, XSD::CodeGen::GenSupport
Defined in:
lib/soybean/interface_builder.rb

Defined Under Namespace

Classes: MethodDefCreator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of InterfaceBuilder.



8
9
10
11
12
13
# File 'lib/soybean/interface_builder.rb', line 8

def initialize(definitions, name_creator, modulepath = nil)
  @definitions = definitions
  @name_creator = name_creator
  @modulepath = modulepath
  @porttype = @definitions.porttypes.first
end

Instance Attribute Details

#definitionsObject (readonly)

Returns the value of attribute definitions.



6
7
8
# File 'lib/soybean/interface_builder.rb', line 6

def definitions
  @definitions
end

Instance Method Details

#actionsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/soybean/interface_builder.rb', line 37

def actions
  assigned_method = collect_assigned_method(@definitions, @porttype.name, @modulepath)
  binding = @porttype.find_binding
  if binding
    binding.operations.map do |op_bind|
      operation = op_bind.find_operation
      if operation.nil?
        warn("operation not found for binding: #{op_bind}")
        next
      end
      name = assigned_method[op_bind.boundid] || operation.name
      methodname = safemethodname(name)
      input = operation.input
      params = input.find_message.parts.collect { |part|
        safevarname(part.name)
      }
      [methodname.underscore, params, operation]
    end
  else
    []
  end
end

#dumpObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/soybean/interface_builder.rb', line 15

def dump
  result = ""
  if @modulepath
    result << "\n"
    modulepath = @modulepath.respond_to?(:lines) ? @modulepath.lines : @modulepath # RubyJedi: compatible with Ruby 1.8.6 and above
    result << modulepath.collect { |ele| "module #{ele}" }.join("; ")
    result << "\n\n"
  end
  result << dump_porttype
  if @modulepath
    result << "\n\n"
    modulepath = @modulepath.respond_to?(:lines) ? @modulepath.lines : @modulepath # RubyJedi: compatible with Ruby 1.8.6 and above
    result << modulepath.collect { |ele| "end" }.join("; ")
    result << "\n"
  end
  result
end

#mapped_class_basenameObject



33
34
35
# File 'lib/soybean/interface_builder.rb', line 33

def mapped_class_basename(*)
  (@definitions.name.name.gsub(/Service$/, '') rescue 'Base') + 'Interface'
end