Moving space to object class

away from Parfait module, as that gets collapsed
Leaving shortcut outside parfait for now
This commit is contained in:
2019-09-18 22:36:56 +03:00
parent 41617519d9
commit b0d1948800
14 changed files with 55 additions and 44 deletions

View File

@ -45,12 +45,12 @@ module Parfait
def self.for_hash( hash , object_class = :Object)
name = object_class
if(object_class.is_a?(Symbol))
object_class = Parfait.object_space.get_class_by_name(object_class)
object_class = Object.object_space.get_class_by_name(object_class)
end
raise "No such class #{name}" unless object_class
hash = {type: object_class.name }.merge(hash) unless hash[:type]
new_type = Type.new( object_class , hash)
Parfait.object_space.add_type(new_type)
Object.object_space.add_type(new_type)
end
# should not be called directly. Use Type.for_hash instead, that adds the