L
Larry Fast
It looks like YAML can't restore a Method pointer. True? Or am I doing
something wrong here. Is this a known Ruby bug or a limitation of YAML
or a Larry-is-a-goof problem? The following code frag fails on the last
line when it tries to load the YAML string...
class MyKlass
def initialize
@myMethodPtr = methodmyMethod)
end
def myMethod command
end
end
myObj = MyKlass.new
puts myObj.to_yaml # YAML text generated but it's missing the Method
Info
$newObj = YAML.load( myObj.to_yaml ) # FAILS HERE
------ OUTPUT ------
--- !ruby/object:MyKlass
myMethodPtr: !ruby/object:Method {}
C:/ruby/lib/ruby/1.8/yaml.rb:133:in `transfer': allocator undefined for
Method (TypeError)
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `node_import'
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from x_yml_builder.rb:12
Thanks,
Larry Fast
something wrong here. Is this a known Ruby bug or a limitation of YAML
or a Larry-is-a-goof problem? The following code frag fails on the last
line when it tries to load the YAML string...
class MyKlass
def initialize
@myMethodPtr = methodmyMethod)
end
def myMethod command
end
end
myObj = MyKlass.new
puts myObj.to_yaml # YAML text generated but it's missing the Method
Info
$newObj = YAML.load( myObj.to_yaml ) # FAILS HERE
------ OUTPUT ------
--- !ruby/object:MyKlass
myMethodPtr: !ruby/object:Method {}
C:/ruby/lib/ruby/1.8/yaml.rb:133:in `transfer': allocator undefined for
Method (TypeError)
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `node_import'
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from C:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from x_yml_builder.rb:12
Thanks,
Larry Fast