start writing parfait witout the module
Parfait classes must be unscoped. Now we start parsing Parfait, it must be without the module. Luckily module_eval makes this a breeze. Also remove string interpolation that is not yet processed
This commit is contained in:
@ -1,9 +1,31 @@
|
||||
# Parfait is the ruby runtime
|
||||
module Parfait
|
||||
TYPE_INDEX = 0
|
||||
|
||||
class Object
|
||||
def self.memory_size
|
||||
8
|
||||
end
|
||||
def self.type_length
|
||||
1
|
||||
end
|
||||
def self.new( *args )
|
||||
object = self.allocate
|
||||
# have to grab the class, because we are in the ruby class not the parfait one
|
||||
cl = Parfait.object_space.get_class_by_name( self.name.split("::").last.to_sym)
|
||||
# and have to set the type before we let the object do anything. otherwise boom
|
||||
object.set_type cl.instance_type
|
||||
object.send :initialize , *args
|
||||
object
|
||||
end
|
||||
|
||||
end
|
||||
["object" , "factory" ].each do |file_name|
|
||||
path = File.expand_path( "../parfait/#{file_name}.rb" , __FILE__)
|
||||
module_eval( File.read path)
|
||||
end
|
||||
end
|
||||
|
||||
require_relative "parfait/object"
|
||||
require_relative "parfait/factory"
|
||||
require_relative "parfait/data_object"
|
||||
require_relative "parfait/integer"
|
||||
require_relative "parfait/behaviour"
|
||||
|
Reference in New Issue
Block a user