Class: Xumlidot::Types::Klass

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/xumlidot/types/klass.rb

Overview

representation for a class

Direct Known Subclasses

Module

Instance Method Summary collapse

Constructor Details

#initialize(definition) ⇒ Klass

Returns a new instance of Klass.



36
37
38
39
40
41
42
43
# File 'lib/xumlidot/types/klass.rb', line 36

def initialize(definition)
  @definition = definition

  @instance_methods = InstanceMethods.new
  @class_methods = KlassMethods.new
  @attributes = Attributes.new
  @constants = Constants.new
end

Instance Method Details

#add_method(method_name) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/xumlidot/types/klass.rb', line 49

def add_method(method_name)
  method_name = method_name.definition if method_name.respond_to?(:definition)

  if method_name.superclass_method == true
    @class_methods << method_name
  else
    @instance_methods << method_name
  end
end

#to_sObject



45
46
47
# File 'lib/xumlidot/types/klass.rb', line 45

def to_s
  "#{definition} "
end