rename layout to type

this one goes to caleb for pointing it out.
Much better word
This commit is contained in:
Torsten Ruger
2016-02-25 11:50:10 -08:00
parent 3480b97eaa
commit d32b51c67b
39 changed files with 328 additions and 328 deletions

View File

@ -8,11 +8,11 @@ module Parfait
# .... the class object but gives us the ability to use the
# syntax as if it were a class
# While the "real" metaclass is the layout, we need to honor the constancy of the layout
# So the layout needs to be copied and replaced anytime it is edited.
# While the "real" metaclass is the type, we need to honor the constancy of the type
# So the type needs to be copied and replaced anytime it is edited.
# And then changed in the original object, and thus we need this level of indirection
# Basically we implement the Behaviour protocol, by forwarding to the layout
# Basically we implement the Behaviour protocol, by forwarding to the type
class MetaClass < Object
include Logging
@ -25,35 +25,35 @@ module Parfait
end
def name
self.object.get_layout.name
self.object.get_type.name
end
# first part of the protocol is read, just forward to self.object.layout
# first part of the protocol is read, just forward to self.object.type
def methods
self.object.get_layout.methods
self.object.get_type.methods
end
def method_names
self.object.get_layout.method_names
self.object.get_type.method_names
end
def get_instance_method fname
self.object.get_layout.get_instance_method fname
self.object.get_type.get_instance_method fname
end
def resolve_method m_name
self.object.get_layout.resolve_method m_name
self.object.get_type.resolve_method m_name
end
# the modifying part creates a new layout
# forwards the action and replaces the layout
# the modifying part creates a new type
# forwards the action and replaces the type
def add_instance_method method
layout = self.object.get_layout.dup
ret = layout.add_instance_method(method)
self.object.set_layout layout
type = self.object.get_type.dup
ret = type.add_instance_method(method)
self.object.set_type type
ret
end
def remove_instance_method method_name
layout = self.object.get_layout.dup
ret = layout.remove_instance_method(method_name)
self.object.set_layout layout
type = self.object.get_type.dup
ret = type.remove_instance_method(method_name)
self.object.set_type type
ret
end