Hi,
Is there any way that YAML can be made to be able to dump classname
constants? It would be most useful, and would mean I could use nice
readable YAML instead of Marshal.
Example:
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> x = String
=> String
irb(main):003:0> Marshal.dump(x)
=> "\004\010c\vString"
irb(main):004:0> x.to_yaml
TypeError: can't dump anonymous class Class
from c:/ruby/lib/ruby/1.8/yaml/rubytypes.rb:9:in `to_yaml'
from (irb):4
irb(main):005:0>
Stephen Sykes
haldane wrote:
Hi,
Is there any way that YAML can be made to be able to dump classname
constants? It would be most useful, and would mean I could use nice
readable YAML instead of Marshal.
Example:
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> x = String
=> String
irb(main):003:0> Marshal.dump(x)
=> "\004\010c\vString"
irb(main):004:0> x.to_yaml
TypeError: can't dump anonymous class Class
from c:/ruby/lib/ruby/1.8/yaml/rubytypes.rb:9:in `to_yaml'
from (irb):4
irb(main):005:0>
Stephen Sykes
There's a quick fix at:
http://ruby-talk.org/95432
I use this all the time. Maybe _why would be willing to adopt it as a standard feature?