basic functions for object

This commit is contained in:
Torsten Ruger 2015-05-14 19:53:56 +03:00
parent 9d711e7766
commit c2b84925a4

View File

@ -19,10 +19,38 @@ module Parfait
@layout.get_class()
end
# class stores the "latest" layout for instances, ir the layout a new object will
# be created with.
# inside parfait (and for now everywhere) these are constant.
@@EMPTY = { :names => [] , :types => []}
def self.class_layout()
@@EMPTY
end
def get_layout()
@layout
end
def instance_variables
@layout.instance_variables
end
def instance_variable_get name
index = instance_variable_defined(name)
return nil if index == nil
return internal_get(index)
end
def instance_variable_set name , value
index = instance_variable_defined(name)
return nil if index == nil
return internal_set(index , value)
end
def instance_variable_defined name
@layout.index_of(name)
end
# Object
# :nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :taint, :tainted?, :untaint,
# :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods,