Most useful instance methods

Ive just been getting to grips with some of the string and array
methods. The basics were easy enough such as reverse. Then came map and
uniq. Im wondering what else is good to practice with. It seems to make
sense to study new methods on the basis of their useage. So what methods
do you constantly use or couldnt live without for arrays and strings
without including the elementary stuff like push pop etc.

Perhaps you think there arent that many methods but to a beginner like
me every time i open the pickaxe to look at what method could help solve
a problem I soon feel lost amongst them.

···

--
Posted via http://www.ruby-forum.com/.

I suggest reading though the whole reference section, at least enough
to get a quick imprint of every core method. Start with Kernel/Object
though.

T.

···

On Feb 12, 6:07 pm, Adam Akhtar <adamtempor...@gmail.com> wrote:

Ive just been getting to grips with some of the string and array
methods. The basics were easy enough such as reverse. Then came map and
uniq. Im wondering what else is good to practice with. It seems to make
sense to study new methods on the basis of their useage. So what methods
do you constantly use or couldnt live without for arrays and strings
without including the elementary stuff like push pop etc.

Perhaps you think there arent that many methods but to a beginner like
me every time i open the pickaxe to look at what method could help solve
a problem I soon feel lost amongst them.

inject, *, +, -, sort(with and without block), compact and join from the Array.

···

On Wed, Feb 13, 2008 at 12:07 AM, Adam Akhtar <adamtemporary@gmail.com> wrote:

Ive just been getting to grips with some of the string and array
methods. The basics were easy enough such as reverse. Then came map and
uniq. Im wondering what else is good to practice with. It seems to make
sense to study new methods on the basis of their useage. So what methods
do you constantly use or couldnt live without for arrays and strings
without including the elementary stuff like push pop etc.

Trans wrote:

Ive just been getting to grips with some of the string and array
methods. The basics were easy enough such as reverse. Then came map and
uniq. Im wondering what else is good to practice with. It seems to make
sense to study new methods on the basis of their useage. So what methods
do you constantly use or couldnt live without for arrays and strings
without including the elementary stuff like push pop etc.

Perhaps you think there arent that many methods but to a beginner like
me every time i open the pickaxe to look at what method could help solve
a problem I soon feel lost amongst them.

I suggest reading though the whole reference section, at least enough
to get a quick imprint of every core method. Start with Kernel/Object
though.

Good plan.

The problem with trying to pick the "most used" is that it becomes self-fulfilling. Most people will tend to use the methods that are most familiar, which makes them *more* familiar, which makes them more often used. And so on.

Here's a small hacking project:

Write a ruby app that grabs a random API page from ruby-doc.org and brings it up in a browser.

Run it a few times each day and scan over what you see.

After a while, as you code, you'll start recalling various methods that seem just right for various tasks, and your Ruby vocabulary and experience will expand.

···

On Feb 12, 6:07 pm, Adam Akhtar <adamtempor...@gmail.com> wrote:

--
James Britt

www.risingtidesoftware.com - Wicked Cool Coding
www.rubystuff.com - The Ruby Store for Ruby Stuff

What a great idea! I just wrote it. Thank you!

For those interested: It uses the Windows start command to open a site
from the Ruby 1.8.6 Core rubydoc list.

require 'open-uri'
require 'hpricot'

base = "http://ruby-doc.org/core/&quot;
topic_site = Hpricot(open(base + "fr_class_index.html"))
list = topic_site.search("//div[@id='index-entries']/a[@href]")
system("start " + base + list[rand(list.length)].attributes['href'])

···

On Wed, Feb 13, 2008 at 8:52 AM, James Britt <james.britt@gmail.com> wrote:

Write a ruby app that grabs a random API page from ruby-doc.org and
brings it up in a browser.

yeah sounds like a cool learning project as well. Ive deliberately
avoided looking at the above code and will give this a shot. Thanks as
well for the method recs!

···

--
Posted via http://www.ruby-forum.com/.