A
ara.t.howard
i had a method like this in my OrderedHash class
def yaml_inline= bool
unless defined? @__yaml_inline_meth
@__yaml_inline_meth =
lambda {|opts|
YAML::quick_emit(id, opts) {|emitter|
emitter << '{ ' << map{|kv| kv.join ': '}.join(', ') << ' }'
}
}
class << self
def to_yaml opts = {}
@__yaml_inline ? @__yaml_inline_meth[ opts ] : super
end
end
end
@__yaml_inline = bool
end
which toggled the yaml output style from the standard one to an inline one. it
blows up now (1.8.4) with
NoMethodError: undefined method `<<' for nil:NilClass
and indeed
jib:~ > ruby -r yaml -e ' YAML::quick_emit(object_id){|e| p [RUBY_VERSION, e.class]; exit} '
["1.8.1", YAML::Syck::Emitter]
harp:~ > ruby -r yaml -e ' YAML::quick_emit(object_id){|e| p [RUBY_VERSION, e.class]; exit} '
["1.8.4", YAML::Syck::Out]
i checked in the docs and am reading the source now - but the fix isn't jumping
out at me. any ideas?
ps. what's with the tab madness in the yaml src! ick.
cheers.
-a
def yaml_inline= bool
unless defined? @__yaml_inline_meth
@__yaml_inline_meth =
lambda {|opts|
YAML::quick_emit(id, opts) {|emitter|
emitter << '{ ' << map{|kv| kv.join ': '}.join(', ') << ' }'
}
}
class << self
def to_yaml opts = {}
@__yaml_inline ? @__yaml_inline_meth[ opts ] : super
end
end
end
@__yaml_inline = bool
end
which toggled the yaml output style from the standard one to an inline one. it
blows up now (1.8.4) with
NoMethodError: undefined method `<<' for nil:NilClass
and indeed
jib:~ > ruby -r yaml -e ' YAML::quick_emit(object_id){|e| p [RUBY_VERSION, e.class]; exit} '
["1.8.1", YAML::Syck::Emitter]
harp:~ > ruby -r yaml -e ' YAML::quick_emit(object_id){|e| p [RUBY_VERSION, e.class]; exit} '
["1.8.4", YAML::Syck::Out]
i checked in the docs and am reading the source now - but the fix isn't jumping
out at me. any ideas?
ps. what's with the tab madness in the yaml src! ick.
cheers.
-a