# Learning Ruby

**URL:** <https://www.ruby-forum.com/t/learning-ruby/94070>\
**Category:** Ruby\
**Created:** [April 19, 2006, 11:09pm UTC](https://www.ruby-forum.com/t/learning-ruby/94070 "2006-04-19T23:09:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 19, 2006, 11:09pm UTC](https://www.ruby-forum.com/t/learning-ruby/94070/1 "2006-04-19T23:09:47Z")

</div>

Okay I’ve went through Chris P.s tutorial on  
programming([Learn to Program, by Chris Pine](http://pine.fm/LearnToProgram/)), and I still don’t fully  
understand what I hear from experienced Ruby programmers. Is there any  
other tutorials that you might spare for a newbly soul such as mine?

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 19, 2006, 11:47pm UTC](https://www.ruby-forum.com/t/learning-ruby/94070/2 "2006-04-19T23:47:11Z")

</div>

Try “programming ruby”. The first edition of it can be accessed for  
free,  
although I recommend that you buy the second edition of it.

2006/4/19, Jesse M [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 12:08am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/3 "2006-04-20T00:08:36Z")

</div>

Jesse M wrote:

> Okay I’ve went through Chris P.s tutorial on  
> programming([Learn to Program, by Chris Pine](http://pine.fm/LearnToProgram/)), and I still don’t fully  
> understand what I hear from experienced Ruby programmers. Is there any  
> other tutorials that you might spare for a newbly soul such as mine?

What don’t you understand?

Cheers,  
Dave

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 12:51am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/4 "2006-04-20T00:51:32Z")

</div>

Jesse M wrote:

> Okay I’ve went through Chris P.s tutorial on  
> programming([Learn to Program, by Chris Pine](http://pine.fm/LearnToProgram/)), and I still don’t fully  
> understand what I hear from experienced Ruby programmers. Is there any  
> other tutorials that you might spare for a newbly soul such as mine?

> **[Ruby-Doc.org: Documenting the Ruby Language](https://ruby-doc.org/gettingstarted/)**
>
> Fast, searchable Ruby documentation for core and standard libraries. Plus, links to tutorials, guides, books, and related sites.

> **[Ruby-Doc.org: Documenting the Ruby Language](https://ruby-doc.org/whyruby/)**
>
> Fast, searchable Ruby documentation for core and standard libraries. Plus, links to tutorials, guides, books, and related sites.

–  
James B.

?Design depends largely on constraints.?  
? Charles Eames

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 12:22am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/5 "2006-04-20T00:22:40Z")

</div>

It can be hard to notice the nice little things until you actually  
implement something. I’m just now knee deep in my first Ruby-based  
project, and not until just recently have I seen what people are talking  
about.

Basically, it’s all just time-saving stuff that doesn’t make ugly code.  
You wont appreciate it until you write some code that should be hideous,  
but turns out (almost) elegant.

Now that I’ve posted this, I’m off to post about something weird,  
unpredictable and frustrating that I’ve found in Ruby 🙂

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 12:54am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/6 "2006-04-20T00:54:34Z")

</div>

Jesse M wrote:

> Okay I’ve went through Chris P.s tutorial on  
> programming([Learn to Program, by Chris Pine](http://pine.fm/LearnToProgram/)), and I still don’t fully  
> understand what I hear from experienced Ruby programmers. Is there any  
> other tutorials that you might spare for a newbly soul such as mine?

> **[Ruby-Doc.org: Documenting the Ruby Language](https://ruby-doc.org/gettingstarted/)**
>
> Fast, searchable Ruby documentation for core and standard libraries. Plus, links to tutorials, guides, books, and related sites.

> **[Ruby-Doc.org: Documenting the Ruby Language](https://ruby-doc.org/whyruby/)**
>
> Fast, searchable Ruby documentation for core and standard libraries. Plus, links to tutorials, guides, books, and related sites.

–  
James B.

?Design depends largely on constraints.?  
? Charles Eames

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 4:35am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/7 "2006-04-20T04:35:02Z")

</div>

I don’t know the syntax.But I think it is same as

[1,2,3].all? {|i| i.positive?}

On 4/20/06, Jesse M [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Cheers,  
> > [1, 2, 3].all? &:positive? =\> true  
> > [-1, 2, 3].all? &:positive? =\> false
> 
> which i don’t understand half of it 🙂 and i’m really gung hoe about it!
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

–  
Chaoqun Li  
ThoughtWorks(Xi’an)  
mobile phone:13909217679  
office phone:029-87607341

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 3:26am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/8 "2006-04-20T03:26:20Z")

</div>

Dave B. wrote:

> Jesse M wrote:
> 
> > Okay I’ve went through Chris P.s tutorial on  
> > programming([Learn to Program, by Chris Pine](http://pine.fm/LearnToProgram/)), and I still don’t fully  
> > understand what I hear from experienced Ruby programmers. Is there any  
> > other tutorials that you might spare for a newbly soul such as mine?
> 
> What don’t you understand?
> 
> Cheers,  
> Dave

Well I see something like,

lass Numeric  
def positive?  
self \> 0  
end  
end

[1, 2, 3].all? &:positive? =\> true  
[-1, 2, 3].all? &:positive? =\> false

which i don’t understand half of it 🙂 and i’m really gung hoe about it!

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 11:19am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/9 "2006-04-20T11:19:21Z")

</div>

> :positive? is a symbol, so it can’t be converted into a block:

yes it can, using the extensions gem and require ‘extensions/symbol’  
[http://extensions.rubyforge.org/rdoc/classes/Symbol.html](http://extensions.rubyforge.org/rdoc/classes/Symbol.html)  
(or by defining your own Symbol#to\_proc method)

---

<div class="post-metadata">

**Author:** ![Jesse\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jesse\_M](https://www.ruby-forum.com/u/Jesse_M)\
**Post date:** [April 20, 2006, 7:28am UTC](https://www.ruby-forum.com/t/learning-ruby/94070/10 "2006-04-20T07:28:28Z")

</div>

Jesse M wrote:

> Well I see something like,
> 
> lass Numeric  
> def positive?  
> self \> 0  
> end  
> end

I assume you understand this from Pine’s LtP.

> [1, 2, 3].all? &:positive? =\> true  
> [-1, 2, 3].all? &:positive? =\> false
> 
> which i don’t understand half of it 🙂 and i’m really gung hoe about it!

Have you tried typing this into IRB? I think you’ll find it doesn’t even  
work.

The & symbol is used to get a Proc from a block passed into a method

class Array  
def eachEven(&wasABlock\_nowAProc) # from LtP Online Chapter 10  
…

or to convert a Proc into a block when _calling_ a method

f = proc do |oddBall|  
puts oddBall.to\_s+’ is NOT an even number!’  
end  
[1, 2, 3, 4, 5].eachEven &f

:positive? is a symbol, so it can’t be converted into a block:

all? and positive? are just methods (methods can end in !, =, or ?).

irb(main):001:0\> [1,2,3].all? &:positive?  
TypeError: wrong argument type Symbol (expected Proc)  
from (irb):1

Then, the “=\> true” and “=\> false” aren’t actually Ruby code, they’re  
just meant to show the reader the value of that expression. Usually we  
put a # in front so it’s valid Ruby code:

positive = proc {|n| n \> 0 }  
[1, 2, 3].all? &positive #=\> true  
[-1, 2, 3].all? &positive #=\> false

Do you follow that (working) rewrite of the snippet? If you type it into  
IRB, you should see the results listed after the “#=\>”.

Anyway, for further reading, I recommend Why’s (Poignant) Guide to Ruby  
if you can deal with reading a wacky story in between learning more  
Ruby.

[http://www.poignantguide.net/ruby/](http://www.poignantguide.net/ruby/)

Or there’s the standard reference, the Pickaxe.

Or you can just ask the list when you have a question!

All the best!  
Dave
