Class: Xumlidot::Types::KlassDefinition
- Inherits:
-
Object
- Object
- Xumlidot::Types::KlassDefinition
- Defined in:
- lib/xumlidot/types/klass_definition.rb
Overview
representation for class information
Direct Known Subclasses
Defined Under Namespace
Classes: Name
Instance Attribute Summary collapse
-
#inherited_modules ⇒ Object
Returns the value of attribute inherited_modules.
-
#name ⇒ Object
Returns the value of attribute name.
-
#superklass ⇒ Object
Returns the value of attribute superklass.
Instance Method Summary collapse
-
#==(other) ⇒ Object
No need to compare namespaces here since that is done in the name.
-
#initialize ⇒ KlassDefinition
constructor
A new instance of KlassDefinition.
-
#root_namespace_for?(other) ⇒ Boolean
Returns true or false depending on whether or not, given the definition for the class, it can be considered the root namespace of the other class.
- #superklass_of?(other) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ KlassDefinition
Returns a new instance of KlassDefinition.
30 31 32 33 34 |
# File 'lib/xumlidot/types/klass_definition.rb', line 30 def initialize @name = Name.new @superklass = Superklass.new(nil) @inherited_modules = [] end |
Instance Attribute Details
#inherited_modules ⇒ Object
Returns the value of attribute inherited_modules.
26 27 28 |
# File 'lib/xumlidot/types/klass_definition.rb', line 26 def inherited_modules @inherited_modules end |
#name ⇒ Object
Returns the value of attribute name.
26 27 28 |
# File 'lib/xumlidot/types/klass_definition.rb', line 26 def name @name end |
#superklass ⇒ Object
Returns the value of attribute superklass.
26 27 28 |
# File 'lib/xumlidot/types/klass_definition.rb', line 26 def superklass @superklass end |
Instance Method Details
#==(other) ⇒ Object
No need to compare namespaces here since that is done in the name
42 43 44 |
# File 'lib/xumlidot/types/klass_definition.rb', line 42 def ==(other) @name == other.name end |
#root_namespace_for?(other) ⇒ Boolean
Returns true or false depending on whether or not, given the definition for the class, it can be considered the root namespace of the other class.
This allows us to work out is this is a klass under which the other
class should be nested in a class or module namespace heirarchy.
52 53 54 |
# File 'lib/xumlidot/types/klass_definition.rb', line 52 def root_namespace_for?(other) [@name.name, @name.namespace].flatten == other.definition.name.namespace end |
#superklass_of?(other) ⇒ Boolean
56 57 58 |
# File 'lib/xumlidot/types/klass_definition.rb', line 56 def superklass_of?(other) [@name.name, @name.namespace].flatten == [other.name, other.namespace].flatten end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/xumlidot/types/klass_definition.rb', line 36 def to_s "KLASS: #{@name.first} < #{@superklass} " end |