create behavior module

behavior handles instance methods (add/remove/find)
and shall be included in layout later too
This commit is contained in:
Torsten Ruger
2015-10-26 13:27:56 +02:00
parent b76c140d32
commit 9f4952b5ac
7 changed files with 78 additions and 98 deletions

View File

@ -1,31 +0,0 @@
module Parfait
# class that acts like a class, but is really the object
# actually we don't store methods in objects (as ruby with singleton_method) but rather
# in the (possibly unique) layout.
# described in the ruby language book as the eigenclass, what you get with
# class MyClass
# class << self <--- this is called the eigenclass, or metaclass, and really is just
# .... the class object but gives us the ability to use the
# syntax as if it were a class
#
class MetaClass < Object
attribute :me
def initialize(object)
super()
self.me = object
end
def super_class
Space.object_space.get_class_by_name(self.me.super_class_name).meta
end
def name
"Meta#{me.name}".to_sym
end
end
end