如果我在 Ruby 1.9 模式下运行 JRuby,并告诉它使用 Syck 而不是 Psych,似乎没有任何效果。我错过了什么吗?
Andrew-Grimms-MacBook-Pro:~ agrimm$ ruby --version
jruby 1.6.1 (ruby-1.8.7-p330) (2011-05-08 3fe11da) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java]
Andrew-Grimms-MacBook-Pro:~ agrimm$ ruby --1.9 -S irb
jruby-head :001 > require "yaml"
=> true
jruby-head :002 > YAML::ENGINE.yamler = "syck"
=> "syck"
jruby-head :003 > YAML::ENGINE.yamler
=> "syck"
jruby-head :004 > 42.to_yaml
NameError: uninitialized constant Syck::Yecht
from org/jruby/RubyModule.java:2569:in `const_missing'
from org/jruby/RubyClass.java:218:in `allocate'
from /Users/agrimm/.rvm/rubies/jruby-head/lib/ruby/1.9/syck.rb:102:in `emitter'
from /Users/agrimm/.rvm/rubies/jruby-head/lib/ruby/1.9/syck.rb:399:in `quick_emit'
from /Users/agrimm/.rvm/rubies/jruby-head/lib/ruby/1.9/syck/rubytypes.rb:371:in `to_yaml'
from (irb):4:in `evaluate'
from org/jruby/RubyKernel.java:1093:in `eval'
from org/jruby/RubyKernel.java:1418:in `loop'
from org/jruby/RubyKernel.java:1205:in `catch'
from org/jruby/RubyKernel.java:1205:in `catch'
from /Users/agrimm/.rvm/rubies/jruby-head/bin/jirb:17:in `(root)'
背景:我正在尝试使用 Syck,因为我在如何反序列化 Psych 中的类?