class Xumlidot::Types::KlassDefinition

representation for class information

Attributes

inherited_modules[RW]
name[RW]
superklass[RW]

Public Class Methods

new() click to toggle source
# File lib/xumlidot/types/klass_definition.rb, line 30
def initialize
  @name = Name.new
  @superklass = Superklass.new(nil)
  @inherited_modules = []
end

Public Instance Methods

==(other) click to toggle source

No need to compare namespaces here since that is done in the name

# File lib/xumlidot/types/klass_definition.rb, line 42
def ==(other)
  @name == other.name
end
root_namespace_for?(other) click to toggle source

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.
# 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) click to toggle source
# 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() click to toggle source
# File lib/xumlidot/types/klass_definition.rb, line 36
def to_s
  "KLASS: #{@name.first} < #{@superklass} "
end