2015-04-08 19:24:50 +02:00
|
|
|
|
2015-04-15 10:38:46 +02:00
|
|
|
# Class derives from and derives most of it's functionality (that you would associate with a class)
|
|
|
|
# from there
|
2015-05-12 08:54:36 +02:00
|
|
|
# class is mainly a list of methods with a name (for now)
|
|
|
|
# layout of object is seperated into Layout
|
2015-04-15 10:38:46 +02:00
|
|
|
|
|
|
|
# A Class is a module that can be instantiated
|
|
|
|
|
2015-04-08 19:24:50 +02:00
|
|
|
# An Object carries the data for the instance variables it has
|
|
|
|
# The Layout lists the names of the instance variables
|
|
|
|
# The class keeps a list of instance methods, these have a name and code
|
|
|
|
|
2015-05-12 08:54:36 +02:00
|
|
|
require_relative "meta_class"
|
|
|
|
|
2015-05-11 17:55:49 +02:00
|
|
|
module Parfait
|
|
|
|
class Class < Module
|
2015-05-12 08:54:36 +02:00
|
|
|
|
2015-05-24 12:53:49 +02:00
|
|
|
def initialize name , super_class
|
2015-05-18 11:35:01 +02:00
|
|
|
super( name , super_class)
|
2015-05-19 19:29:33 +02:00
|
|
|
# the layout for this class (class = object of type Class) carries the class
|
|
|
|
# as an instance. The relation is from an object through the Layout to it's class
|
|
|
|
@object_layout = Layout.new_object(self)
|
|
|
|
end
|
|
|
|
|
2015-05-22 21:51:36 +02:00
|
|
|
def object_layout
|
|
|
|
@object_layout
|
|
|
|
end
|
|
|
|
|
2015-05-19 19:29:33 +02:00
|
|
|
def allocate_object
|
|
|
|
#space, and ruby allocate
|
2015-05-12 08:54:36 +02:00
|
|
|
end
|
|
|
|
|
2015-05-18 11:35:01 +02:00
|
|
|
def add_instance_name name
|
|
|
|
@object_layout.push name
|
2015-05-12 08:54:36 +02:00
|
|
|
end
|
|
|
|
|
2015-05-11 17:55:49 +02:00
|
|
|
# ruby 2.1 list (just for reference, keep at bottom)
|
|
|
|
#:allocate, :new, :superclass
|
|
|
|
end
|
2015-04-06 10:38:11 +02:00
|
|
|
end
|