[LRUG] Ruby functions

Simon Sebright simonsebright at hotmail.com
Thu Oct 29 01:28:07 PDT 2009

From: "Anthony Green" <email at acgreen.co.uk>
Sent: Thursday, October 29, 2009 9:16 AM
To: "Ruby London" <chat at lists.lrug.org>
Subject: Re: [LRUG] Ruby functions

>> First, in irb, we reopened the Fixnum class and added a method double. 
>> Then
>> we successfully called 5.double.  Then we looked at 5.methods and it 
>> wasn't
>> there.  Why is that?  A feature of irb, or is there something more subtle
> Are you sure ?
> I just did a simple test and it is there.
> Try 5.methods.sort to see them in alphabetical order.
Well, I am sure that yesterday we observed that we couldn't see it, but yes, 
on doing it from scratch, it does appear to work.  Could it be that I 
already had the object 5 in the irb session, and its methods were not 
updated?  No, that doesn't seem to apply either.  Perhaps it was a quirk

As a bunch of .net programmers, we were perhaps phased by 1.5 hours of 
command line hacking ;^)


More information about the Chat mailing list