class WsdlMapper::Naming::TypeName

Class to represent the (ruby) type name for an XML (complex or simple) type. This includes the ruby class name and module hierarchy, as well as file name + file path.

Attributes

class_name[R]

@!attribute [r] class_name

@return [String] Class name of the ruby class (to generate), without enclosing modules. E.g. `"Note"` for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] module_path

@return [Array<String>] Hierarchy of enclosing ruby modules. E.g. ["ModuleA", "ModuleB"] for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] file_name

@return [String] File name where to put the ruby class into (including the '.rb' extension). E.g. "note.rb"

@!attribute [r] file_path

@return [Array<String>] File path (without file name) as array, e.g. ["module_a", "module_b"]

@!attribute [rw] parent

@return [TypeName] Parent {TypeName}, usually representing a module, that contains several classes.
file_name[R]

@!attribute [r] class_name

@return [String] Class name of the ruby class (to generate), without enclosing modules. E.g. `"Note"` for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] module_path

@return [Array<String>] Hierarchy of enclosing ruby modules. E.g. ["ModuleA", "ModuleB"] for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] file_name

@return [String] File name where to put the ruby class into (including the '.rb' extension). E.g. "note.rb"

@!attribute [r] file_path

@return [Array<String>] File path (without file name) as array, e.g. ["module_a", "module_b"]

@!attribute [rw] parent

@return [TypeName] Parent {TypeName}, usually representing a module, that contains several classes.
file_path[R]

@!attribute [r] class_name

@return [String] Class name of the ruby class (to generate), without enclosing modules. E.g. `"Note"` for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] module_path

@return [Array<String>] Hierarchy of enclosing ruby modules. E.g. ["ModuleA", "ModuleB"] for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] file_name

@return [String] File name where to put the ruby class into (including the '.rb' extension). E.g. "note.rb"

@!attribute [r] file_path

@return [Array<String>] File path (without file name) as array, e.g. ["module_a", "module_b"]

@!attribute [rw] parent

@return [TypeName] Parent {TypeName}, usually representing a module, that contains several classes.
module_name[R]

@!attribute [r] class_name

@return [String] Class name of the ruby class (to generate), without enclosing modules. E.g. `"Note"` for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] module_path

@return [Array<String>] Hierarchy of enclosing ruby modules. E.g. ["ModuleA", "ModuleB"] for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] file_name

@return [String] File name where to put the ruby class into (including the '.rb' extension). E.g. "note.rb"

@!attribute [r] file_path

@return [Array<String>] File path (without file name) as array, e.g. ["module_a", "module_b"]

@!attribute [rw] parent

@return [TypeName] Parent {TypeName}, usually representing a module, that contains several classes.
module_path[R]

@!attribute [r] class_name

@return [String] Class name of the ruby class (to generate), without enclosing modules. E.g. `"Note"` for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] module_path

@return [Array<String>] Hierarchy of enclosing ruby modules. E.g. ["ModuleA", "ModuleB"] for
                 `::ModuleA::ModuleB::Note`.

@!attribute [r] file_name

@return [String] File name where to put the ruby class into (including the '.rb' extension). E.g. "note.rb"

@!attribute [r] file_path

@return [Array<String>] File path (without file name) as array, e.g. ["module_a", "module_b"]

@!attribute [rw] parent

@return [TypeName] Parent {TypeName}, usually representing a module, that contains several classes.
parent[RW]

Public Class Methods

new(class_name, module_path, file_name, file_path) click to toggle source

Initialize a new instance with the given names / paths

@param [String] class_name @param [Array<String>] module_path @param [String] file_name @param [Array<String>] file_path

# File lib/wsdl_mapper/naming/type_name.rb, line 28
def initialize(class_name, module_path, file_name, file_path)
  @class_name = class_name
  @module_path = module_path
  @file_name = file_name
  @file_path = file_path
end

Public Instance Methods

==(other)
Alias for: eql?
eql?(other) click to toggle source

Determines if this type name is equal to `other`. Two type names are considered equal, if their {TypeName#name} is equal. @param [TypeName] other Other type name to compare to @return [true, false]

# File lib/wsdl_mapper/naming/type_name.rb, line 66
def eql?(other)
  self.class == other.class && name == other.name
end
Also aliased as: ==
hash() click to toggle source

@!visibility private

# File lib/wsdl_mapper/naming/type_name.rb, line 72
def hash
  [self.class, name].hash
end
name() click to toggle source

Full qualified ruby class name, including enclosing modules and root module prefix, e.g. `“::ModuleA::ModuleB::Note”` @return [String]

# File lib/wsdl_mapper/naming/type_name.rb, line 58
def name
  @name ||= ['', *@module_path, @class_name] * '::'
end
parents() click to toggle source

Returns the hierarchy of parents.

@return [Array<TypeName>] List of ancestors, with the immediate {#parent} as first element. `[]` if this

is at root level.
# File lib/wsdl_mapper/naming/type_name.rb, line 39
def parents
  @parents ||= if parent.nil?
    []
  else
    [parent] + parent.parents
  end
end
require_path() click to toggle source

Returns the path necessary to require this type later on.

@return [String] Full (relative) path (excluding the extension) to use in a `require` statement.

E.g. `"module_a/module_b/note"`
# File lib/wsdl_mapper/naming/type_name.rb, line 51
def require_path
  @require_path ||= File.join(*@file_path, File.basename(@file_name, '.rb'))
end