Hello!
Is there a way to force ‘const_missing’ exception in ‘YAML.load’ if the
Class definition is not found?
By default if it can’t find the class definition it just silently
instantiates the YAML::Object stub.
One solution is to add the Class to Domain Types. But for my situation
this is absolutely not suitable.
YAML.add_domain_type(“TheClass,2007”, “”) do |type, val|
klass = eval(type.split(’:’).last)
YAML.object_maker(klass, val)
end
class TheClass
def to_yaml_type
“!TheClass,2007/#{self.class}”
end
end
Other - alter ‘Module’ in ‘yaml/tag.rb’
class Module
# ...
def yaml_tag_read_class( name )
eval(name, TOPLEVEL_BINDING) << ADD THIS LINE
name
end
end
If i alter ‘Module’ in ‘yaml/tag.rb’ it works, but if i override it in
another place it doesn’t. Why?!