From: Jeff Wood Date: 2005-10-17T17:32:43+09:00 Subject: Re: Editing in Ruby ------=_Part_8720_17739989.1129537961204 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I agree with Greg. Add a bit of history capture to your .irbrc script and boom, you've got an auto-complete, code by exploration environment. j. On 10/16/05, Greg Millam wrote: > > Shreyas wrote: > > In any case, I was wondering if anyone knew either (a) how to get a > > list of all the functions in ruby exported to an API file, or (b) if > > there is an editor out there that can help out. Many times when I'm > > programming, it's nice to just be able to see what the valid > > functions are for the object in question, rather than having to look > > it up in the API documentation. > > Use irb with irb/completion > > $ irb > irb(main):001:0> require 'irb/completion' > =3D> true > irb(main):002:0> f =3D "Hello, world!" > =3D> "Hello, world!" > irb(main):003:0> f.downcase > f.downcase f.downcase! > irb(main):003:0> f.downcase > > If you hit f.down, it'll complete to downcase. hit it twice, and > it'll show "f.downcase f.downcase!" > > If you want to find other methods, try using f.methods.grep > > irb(main):004:0> f.methods.grep /case/ > =3D> ["downcase", "downcase!", "casecmp", "swapcase", "swapcase!", > "upcase", "upcase!"] > > f.case will pull out f.casecmp for you. > > This works with any valid object in irb. > > irb(main):005:0> i =3D 1 > =3D> 1 > irb(main):006:0> i.methods.grep /case/ > =3D> [] > irb(main):007:0> i.methods.grep /zero/ > =3D> ["zero?", "nonzero?"] > > > It's very handy, and I use it a lot, even though I've been rubying for > about 3 years. > > Hope that helps you, too! > > - Greg > > -- "http://ruby-lang.org -- do you ruby?" Jeff Wood ------=_Part_8720_17739989.1129537961204--