Re: argh! more undocumented mysteries: to_yaml



[Note: parts of this message were removed to make it a legal post.]

I'm beginner to but I understand it. You cannot use to_yaml for Array,
because there's no method to_yaml for Array. Try to read about
Object#to_yaml in Ruby Documentation.

2008/3/16, Tom Cloyd <tomcloyd@xxxxxxxxxxx>:

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.

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< tc@xxxxxxxxxxxx >> (email)
<< TomCloyd.com >> (website & psychotherapy weblog)
<< sleightmind.wordpress.com >> (mental health issues weblog)
<< directpathdesign.com >> (web site design & consultation)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




.



Relevant Pages

  • Re: Real Beginner
    ... I am a real beginner so at the risk of being slammed by some, ... my $lastperson = shift @peoplec; ... Then you shouldn't have to iterate through each item of the array, or 'shift' off items from a duplicated array. ...
    (perl.beginners)
  • Re: Does Array Declaration Provide Zero Initial Values ??
    ... drop the beginner description. ... printed really big letters on fanfold paper, ... filled up a 120 by 60 array for each letter, and then printed that, ...
    (comp.lang.fortran)
  • Re: date format
    ... I'm not a beginner and I found this example rather obscure and hard to ... Perl needn't look that much like line noise IMO. ... but the content of that array is not univocal here anyway) ...
    (comp.lang.perl.misc)
  • type mismatch
    ... I am a beginner in programming VBA ... I want to write a function that returns an array where each element is ... Ctrl-Shift-Enter ...
    (microsoft.public.excel.programming)
  • Re: RI not working
    ... Pickaxe book) or ri Array I get the following: ... For what it's worth, I tried 'ri Array' on 10.5.3 and it worked fine. ... the ruby documentation. ...
    (comp.lang.ruby)