From: Phillip Gawlowski Date: 2008-03-16T23:15:47+09:00 Subject: Re: argh! more undocumented mysteries: to_yaml Tom Cloyd wrote: > Beginner woes, here, no doubt, but woes nevertheless. > > I'm exploring the wonders of the Object class, and I see Object#to_yaml. > Seems pretty obvious what to expect here, which would seem to account > for the total lack of documentation in each of the gazillion instances > of this method which appear in core library. Still, let's test it... > > irb(main):010:0> [2,5,3,6,'abc'].to_yaml > NoMethodError: undefined method `to_yaml' for [2, 5, 3, 6, "abc"]:Array > from (irb):10 > from :0 > > Can someone explain what just happened? > > Thanks! > > t. > irb(main):005:0> [2,3,4].to_yaml NoMethodError: undefined method `to_yaml' for [2, 3, 4]:Array from (irb):5 from :0 irb(main):006:0> require "yaml" => true irb(main):008:0> [2,3,4].to_yaml => "--- \n- 2\n- 3\n- 4\n" See also: http://ruby-doc.org/core/classes/YAML.html --Phillip Gawlowski