Class: Xumlidot::Types::Superklass
- Defined in:
- lib/xumlidot/types/superklass.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Constant
Instance Method Summary collapse
- #<<(constant) ⇒ Object
-
#initialize(name, namespace = nil) ⇒ Superklass
constructor
A new instance of Superklass.
-
#to_klass ⇒ Object
Create a klass from the superclass for adding to the list of constants.
Methods inherited from Constant
Constructor Details
#initialize(name, namespace = nil) ⇒ Superklass
Returns a new instance of Superklass.
8 9 10 11 |
# File 'lib/xumlidot/types/superklass.rb', line 8 def initialize(name, namespace = nil) super @has_root = false end |
Instance Method Details
#<<(constant) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/xumlidot/types/superklass.rb', line 13 def <<(constant) if constant == '::' @has_root = true # TODO: I don't see this used anywhere, remove? return end @namespace << constant unless @name.nil? @name ||= constant # rubocop:disable Naming/MemoizedInstanceVariableName end |
#to_klass ⇒ Object
Create a klass from the superclass for adding to the list of constants.
24 25 26 27 28 29 |
# File 'lib/xumlidot/types/superklass.rb', line 24 def to_klass definition = KlassDefinition.new definition.name << ::Xumlidot::Types::Constant.new(@name, @namespace) Klass.new(definition) end |