From: Leslie Viljoen Date: 2006-08-04T06:52:38+09:00 Subject: Re: I'm having a hard time learning ruby. On 8/3/06, Just Another Victim of the Ambient Morality wrote: > > "Nate Imaqaguy" wrote in message > The "methods" method works anywhere in Ruby but it is most useful in an > IRB session. > I'm unsure why you want to type in your entire program into IRB. You > probably just want to type in relevant situations to test Ruby's behaviour, > such as operator precedence or regex behaviour. > If you want to look at all the methods of a class, you simply need to > create an object of said class and call the "methods" method, perahps > followed by the "sort" method which can help you find what you're lookig > for.. I have often typed a program in a text editor and then just pasted it into an IRB window to play with dynamically. On Linux this is easy, on windows you right-click on the IRB window's title-bar and go to edit->paste. If you installed on Windows and used the one-click installer, check out Fxri - it's a "graphical" irb and ri all in one. If you find yourself pasting your programs into IRB a lot, you'll also want to look at the ruby-breakpoint library, which allows your program to run and then "break out" into an IRB session right in the middle so you can look at the variables and methods right there. To try it, go to the prompt and: gem-install ruby-breakpoint Then write your program: require 'breakpoint' ....some code... breakpoint ..some more code... More info here: http://ruby-breakpoint.rubyforge.org/doc/ Les