why the lucky stiff
2/3/2006 5:18:00 PM
ara.t.howard@noaa.gov wrote:
> 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
>
Yeah, you can't write directly to the output stream any longer. But the
emitter is much smarter, more capable now (and utterly non-rdoc'd).
In current versions, you can define a `to_yaml_style' method which
expects a symbol describing how to output the object. In this case,
you'll want to reply with :inline.
>> hsh = {'to' => 'ara.t.howard@noaa.gov', 'x-mail-count' => 178223,
'from' => 'why@ruby-lang.org'}
>> def hsh.to_yaml_style; :inline end
=> nil
>> y [hsh, {'Subject' => 'Re: YAML::quick_emit api change'}]
---
- {from: why@ruby-lang.org, x-mail-count: 178223, to:
ara.t.howard@noaa.gov}
- Subject: "Re: YAML::quick_emit api change"
=> nil
> i checked in the docs and am reading the source now - but the fix
> isn't jumping
> out at me. any ideas?
I just need to improve the rdoc. What a sorry state I've left us all in!
_why