# Most useful instance methods

**URL:** <https://www.ruby-forum.com/t/most-useful-instance-methods/128957>\
**Category:** Ruby\
**Created:** [February 13, 2008, 12:07am UTC](https://www.ruby-forum.com/t/most-useful-instance-methods/128957 "2008-02-13T00:07:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [February 13, 2008, 12:07am UTC](https://www.ruby-forum.com/t/most-useful-instance-methods/128957/1 "2008-02-13T00:07:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [February 13, 2008, 1:20am UTC](https://www.ruby-forum.com/t/most-useful-instance-methods/128957/2 "2008-02-13T01:20:46Z")

</div>

On Feb 12, 6:07 pm, Adam A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.

T.

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [February 13, 2008, 7:20am UTC](https://www.ruby-forum.com/t/most-useful-instance-methods/128957/3 "2008-02-13T07:20:06Z")

</div>

On Wed, Feb 13, 2008 at 12:07 AM, Adam A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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.

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

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [February 13, 2008, 8:52am UTC](https://www.ruby-forum.com/t/most-useful-instance-methods/128957/4 "2008-02-13T08:52:56Z")

</div>

Trans wrote:

> > 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](http://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.

–  
James B.

[www.risingtidesoftware.com](http://www.risingtidesoftware.com) - Wicked Cool Coding  
[www.rubystuff.com](http://www.rubystuff.com) - The Ruby Store for Ruby Stuff

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [February 13, 2008, 2:47pm UTC](https://www.ruby-forum.com/t/most-useful-instance-methods/128957/5 "2008-02-13T14:47:38Z")

</div>

On Wed, Feb 13, 2008 at 8:52 AM, James B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Write a ruby app that grabs a random API page from [ruby-doc.org](http://ruby-doc.org) and  
> brings it up in a browser.

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 = “[RDoc Documentation](http://ruby-doc.org/core/)”  
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’])

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [February 13, 2008, 11:47pm UTC](https://www.ruby-forum.com/t/most-useful-instance-methods/128957/6 "2008-02-13T23:47:51Z")

</div>

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!
