class WsdlMapper::Naming::SeparatingNamer

Namer implementation which puts the generated classes into different namespaces, according to their funtion: `Types` for types, `S8r` for serializers and `D10r` for deserializers.

Public Class Methods

new(module_path: [], content_attribute_name: 'content', soap_array_item_name: 'item', types_module: ['Types'], s8r_module: ['S8r'], d10r_module: ['D10r']) click to toggle source

@param [Array<String>] module_path Root module path, e.g. to generate classes in

`::MyApi::Types`, specify `['MyApi']` as root module path

@param [String] content_attribute_name Sets name of the attribute generated for direct content

of types. You can change it, if this clashes with attributes
in your schema.

@param [Array<String>] types_module Where to generate types @param [Array<String>] s8r_module Where to genereate serializers @param [Array<String>] d10r_module Where to generate deserializers

Calls superclass method WsdlMapper::Naming::DefaultNamer::new
# File lib/wsdl_mapper/naming/separating_namer.rb, line 18
def initialize(module_path: [],
    content_attribute_name: 'content',
    soap_array_item_name: 'item',
    types_module: ['Types'],
    s8r_module: ['S8r'],
    d10r_module: ['D10r'])

  super(module_path: module_path,
      content_attribute_name: content_attribute_name,
      soap_array_item_name: soap_array_item_name)

  @types_module = types_module
  @s8r_module = s8r_module
  @d10r_module = d10r_module
end

Protected Instance Methods

get_accessor_name(name) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 91
def get_accessor_name(name)
  get_key_name name
end
get_camelized_name(name) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 99
def get_camelized_name(name)
  camelize name
end
get_class_file_name(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 79
def get_class_file_name(type)
  get_file_name type.name.name
end
get_class_file_path(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 47
def get_class_file_path(type)
  get_file_path get_class_module_path type
end
get_class_module_path(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 39
def get_class_module_path(type)
  @module_path + @types_module
end
get_class_name(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 75
def get_class_name(type)
  get_camelized_name type.name.name
end
get_constant_name(name) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 83
def get_constant_name(name)
  get_key_name(name).upcase
end
get_d10r_class_name(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 63
def get_d10r_class_name(type)
  get_camelized_name(type.name.name) + 'Deserializer'
end
get_d10r_file_name(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 59
def get_d10r_file_name(type)
  underscore(type.name.name) + '_deserializer.rb'
end
get_d10r_file_path(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 55
def get_d10r_file_path(type)
  get_file_path get_d10r_module_path type
end
get_d10r_module_path(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 43
def get_d10r_module_path(type)
  @module_path + @d10r_module
end
get_file_name(name) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 103
def get_file_name(name)
  underscore(name) + '.rb'
end
get_file_path(path) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 107
def get_file_path(path)
  path.map do |m|
    underscore m
  end
end
get_key_name(name) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 87
def get_key_name(name)
  underscore sanitize name
end
get_s8r_class_name(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 71
def get_s8r_class_name(type)
  get_camelized_name(type.name.name) + 'Serializer'
end
get_s8r_file_name(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 67
def get_s8r_file_name(type)
  underscore(type.name.name) + '_serializer.rb'
end
get_s8r_file_path(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 51
def get_s8r_file_path(type)
  get_file_path get_s8r_module_path type
end
get_s8r_module_path(type) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 35
def get_s8r_module_path(type)
  @module_path + @s8r_module
end
get_var_name(name) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 95
def get_var_name(name)
  "@#{get_accessor_name(name)}"
end
sanitize(name) click to toggle source
# File lib/wsdl_mapper/naming/separating_namer.rb, line 113
def sanitize(name)
  if valid_symbol? name
    name
  else
    "value_#{name}"
  end
end