Class: WsdlMapper::Naming::TypeName
- Inherits:
-
Object
- Object
- WsdlMapper::Naming::TypeName
- Defined in:
- lib/wsdl_mapper/naming/type_name.rb
Overview
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.
Instance Attribute Summary (collapse)
-
- (String) class_name
(also: #module_name)
readonly
Class name of the ruby class (to generate), without enclosing modules.
-
- (String) file_name
readonly
File name where to put the ruby class into (including the '.rb' extension).
-
- (Object) file_path
readonly
Returns the value of attribute file_path.
-
- (Array<String>) module_path
readonly
Hierarchy of enclosing ruby modules.
-
- (TypeName) parent
Parent TypeName, usually representing a module, that contains several classes.
Instance Method Summary (collapse)
-
- (true, false) eql?(other)
(also: #==)
Determines if this type name is equal to
other
. -
- (TypeName) initialize(class_name, module_path, file_name, file_path)
constructor
Initialize a new instance with the given names / paths.
-
- (String) name
Full qualified ruby class name, including enclosing modules and root module prefix, e.g.
-
- (Array<TypeName>) parents
Returns the hierarchy of parents.
-
- (String) require_path
Returns the path necessary to require this type later on.
Constructor Details
- (TypeName) initialize(class_name, module_path, file_name, file_path)
Initialize a new instance with the given names / paths
28 29 30 31 32 33 |
# 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 |
Instance Attribute Details
- (String) class_name (readonly) Also known as: module_name
Returns Class name of the ruby class (to generate), without enclosing modules. E.g. "Note"
for
::ModuleA::ModuleB::Note
.
18 19 20 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 18 def class_name @class_name end |
- (String) file_name (readonly)
Returns File name where to put the ruby class into (including the '.rb' extension). E.g. "note.rb"
18 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 18 attr_reader :class_name, :module_path, :file_name, :file_path |
- (Object) file_path (readonly)
Returns the value of attribute file_path
18 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 18 attr_reader :class_name, :module_path, :file_name, :file_path |
- (Array<String>) module_path (readonly)
Returns Hierarchy of enclosing ruby modules. E.g. ["ModuleA", "ModuleB"] for
::ModuleA::ModuleB::Note
.
18 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 18 attr_reader :class_name, :module_path, :file_name, :file_path |
- (TypeName) parent
Returns Parent WsdlMapper::Naming::TypeName, usually representing a module, that contains several classes.
18 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 18 attr_reader :class_name, :module_path, :file_name, :file_path |
Instance Method Details
- (true, false) eql?(other) Also known as: ==
Determines if this type name is equal to other
. Two type names are considered
equal, if their #name is equal.
66 67 68 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 66 def eql?(other) self.class == other.class && name == other.name end |
- (String) name
Full qualified ruby class name, including enclosing modules and root module prefix, e.g.
"::ModuleA::ModuleB::Note"
58 59 60 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 58 def name @name ||= ['', *@module_path, @class_name] * '::' end |
- (Array<TypeName>) parents
Returns the hierarchy of parents.
39 40 41 42 43 44 45 |
# File 'lib/wsdl_mapper/naming/type_name.rb', line 39 def parents @parents ||= if parent.nil? [] else [parent] + parent.parents end end |
- (String) require_path
Returns the path necessary to require this type later on.
51 52 53 |
# 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 |