# Cipher book for ruby

**URL:** https://rubytalk.org/t/cipher-book-for-ruby/3192
**Category:** ruby-talk
**Created:** [1 December 2002 00:26 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192 "2002-12-01T00:26:59Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![Shannon\_Fang](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shannon\_Fang](https://rubytalk.org/u/Shannon_Fang)
#### Post date: [1 December 2002 00:26 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/1 "2002-12-01T00:26:59Z")

</div>

Hi all ruby gurus there,

I suggest if some one can initiate a documentation project for ruby? I  
would call it The Ruby Cipher Book, or Ruby Demystified. In this  
document, all ruby symobs, prefixes suffixes are explained, with  
reference to the chapter in the online manual…

I encountered a symbol I don’t understand, may be simply I didn’t read  
the manual careful enough – sorry.

@@var={ } ??

I knew that [] is for array, but what is { }?

There are a lot such cryptic things, some I know some I don’t, such as

%w, \<\< === \< ! ~ $\_ …

I do hope there are a quick reference of these horrible things. :-p

Shannon

---

<div class="post-metadata">

### Author: ![Bill\_Kelly](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@Bill\_Kelly](https://rubytalk.org/u/Bill_Kelly)
#### Post date: [1 December 2002 01:17 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/2 "2002-12-01T01:17:28Z")

</div>

Hi Shannon,

> Hi all ruby gurus there,
> 
> I suggest if some one can initiate a documentation project for ruby? I  
> would call it The Ruby Cipher Book, or Ruby Demystified. In this  
> document, all ruby symobs, prefixes suffixes are explained, with  
> reference to the chapter in the online manual…

I’m expecting anyone would be in favor of various improvements  
to our online documentation. Perhaps if you begin such a  
document…? 🙂

> I encountered a symbol I don’t understand, may be simply I didn’t read  
> the manual careful enough – sorry.
> 
> @@var={ } ??
> 
> I knew that is for array, but what is { }?

The print version of Programming Ruby has a truly impressive and  
useful index. In it, you’ll find:

{…}  
hash literal 11, 206  
in pattern 61, 209  
see also Block

Or… never underestimate IRB:

> {}.class  
> Hash

Aha!

Regards,

Bill

> **···**
>
> From: “Shannon Fang” [xrfang@hotmail.com](mailto:xrfang@hotmail.com)

---

<div class="post-metadata">

### Author: ![David\_Alan\_Black1](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@David\_Alan\_Black1](https://rubytalk.org/u/David_Alan_Black1)
#### Post date: [1 December 2002 03:09 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/3 "2002-12-01T03:09:16Z")

</div>

Hi –

> Hi all ruby gurus there,
> 
> I suggest if some one can initiate a documentation project for ruby? I  
> would call it The Ruby Cipher Book, or Ruby Demystified. In this  
> document, all ruby symobs, prefixes suffixes are explained, with  
> reference to the chapter in the online manual…

I thought there was something like that around (a concordance to the  
online pickaxe) but I can’t seem to pinpoint it (assuming it actually  
exists in the first place). Anyway, you might also be interested in  
the rubydoc book project: [http://www.rubydoc.org/book](http://www.rubydoc.org/book). It’s an  
ongoing, online, collaborative Ruby book.

If you do start a new documentation project, I’d encourage you not to  
use a name that makes it sound like Ruby is somehow mystifying or  
cryptic in the first place. Ruby is actually unusually clear and  
transparent in its syntax. Of course there are things whose meaning  
isn’t clear until you learn them specifically – but that’s true in  
any programming language, and it would be misleading to give the  
impression that learning Ruby equates to demystifying it.

David

> **···**
>
> On Sun, 1 Dec 2002, Shannon Fang wrote:
> 
> –  
> David Alan Black  
> home: [dblack@candle.superlink.net](mailto:dblack@candle.superlink.net)  
> work: blackdav@shu.edu  
> Web: [http://pirate.shu.edu/~blackdav](http://pirate.shu.edu/~blackdav)

---

<div class="post-metadata">

### Author: ![Martin\_DeMello1](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Martin\_DeMello1](https://rubytalk.org/u/Martin_DeMello1)
#### Post date: [1 December 2002 08:02 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/4 "2002-12-01T08:02:03Z")

</div>

This might actually be a lot easier to do from a newcomer’s  
perspective. Why don’t you start a wiki page at [rubygarden.org](http://rubygarden.org), with the  
things that mystify you? The list can fill in the answers, and it’d be a  
valuable resource for other newcomers.

martin

> **···**
>
> Shannon Fang [xrfang@hotmail.com](mailto:xrfang@hotmail.com) wrote:
> 
> > Hi all ruby gurus there,
> > 
> > I suggest if some one can initiate a documentation project for ruby? I  
> > would call it The Ruby Cipher Book, or Ruby Demystified. In this  
> > document, all ruby symobs, prefixes suffixes are explained, with  
> > reference to the chapter in the online manual…

---

<div class="post-metadata">

### Author: ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)
#### Post date: [1 December 2002 10:27 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/5 "2002-12-01T10:27:09Z")

</div>

> > Hi all ruby gurus there,
> > 
> > I suggest if some one can initiate a documentation project for ruby? I  
> > would call it The Ruby Cipher Book, or Ruby Demystified. In this  
> > document, all ruby symobs, prefixes suffixes are explained, with  
> > reference to the chapter in the online manual…
> 
> This might actually be a lot easier to do from a newcomer’s  
> perspective. Why don’t you start a wiki page at [rubygarden.org](http://rubygarden.org), with the  
> things that mystify you? The list can fill in the answers, and it’d be a  
> valuable resource for other newcomers.
> 
> martin

That would be good fodder for the FAQ as well. A question “What on earth do  
the following symbols mean…?” would be a good catch-all.

Gavin

> **···**
>
> From: “Martin DeMello” [martindemello@yahoo.com](mailto:martindemello@yahoo.com)
> 
> > Shannon Fang [xrfang@hotmail.com](mailto:xrfang@hotmail.com) wrote:

---

<div class="post-metadata">

### Author: ![Shannon\_Fang](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shannon\_Fang](https://rubytalk.org/u/Shannon_Fang)
#### Post date: [1 December 2002 13:01 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/6 "2002-12-01T13:01:35Z")

</div>

Hi all,

My feeling toward C++, and ruby, and any other language is that when you  
learn it more, it becomes more cryptic. Ruby is in deed very impressive,  
powerful, and easy to read. If I write my own program in ruby, I may not  
use anything like symbol in years, but when I try to read other’s  
program, I will see it, and then I will try painfully to find out what  
does that mean, and miserablly failed.

In fact, after some suggestion here, I read chap 18 “the ruby  
programming language” again, and found explanation of most cryptic  
historic symbols borrowed from perl. But it is still hard to lookup in  
an emergency. In the document it follows a printed format referring to  
page 202, for example. But HTML help file don’t have page at all.

Hence, what I suggested is a proper index of every sytactic elements in  
the help file. Bill suggested that the printed version already have that.  
Why not the online version?

Regards,  
Shannon

> **···**
>
> On Sun, 1 Dec 2002 12:09:16 +0900 [dblack@candle.superlink.net](mailto:dblack@candle.superlink.net) wrote:
> 
> > Hi –
> > 
> > On Sun, 1 Dec 2002, Shannon Fang wrote:
> > 
> > > Hi all ruby gurus there,
> > > 
> > > I suggest if some one can initiate a documentation project for ruby? I  
> > > would call it The Ruby Cipher Book, or Ruby Demystified. In this  
> > > document, all ruby symobs, prefixes suffixes are explained, with  
> > > reference to the chapter in the online manual…
> > 
> > I thought there was something like that around (a concordance to the  
> > online pickaxe) but I can’t seem to pinpoint it (assuming it actually  
> > exists in the first place). Anyway, you might also be interested in  
> > the rubydoc book project: [http://www.rubydoc.org/book](http://www.rubydoc.org/book). It’s an  
> > ongoing, online, collaborative Ruby book.
> > 
> > If you do start a new documentation project, I’d encourage you not to  
> > use a name that makes it sound like Ruby is somehow mystifying or  
> > cryptic in the first place. Ruby is actually unusually clear and  
> > transparent in its syntax. Of course there are things whose meaning  
> > isn’t clear until you learn them specifically – but that’s true in  
> > any programming language, and it would be misleading to give the  
> > impression that learning Ruby equates to demystifying it.
> > 
> > David
> > 
> > –  
> > David Alan Black  
> > home: [dblack@candle.superlink.net](mailto:dblack@candle.superlink.net)  
> > work: blackdav@shu.edu  
> > Web: [http://pirate.shu.edu/~blackdav](http://pirate.shu.edu/~blackdav)

---

<div class="post-metadata">

### Author: ![Shannon\_Fang](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shannon\_Fang](https://rubytalk.org/u/Shannon_Fang)
#### Post date: [1 December 2002 13:06 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/7 "2002-12-01T13:06:09Z")

</div>

Hi Martin,

> **···**
>
> On Sun, 1 Dec 2002 17:02:03 +0900 Martin DeMello [martindemello@yahoo.com](mailto:martindemello@yahoo.com) wrote:
> 
> > This might actually be a lot easier to do from a newcomer’s  
> > perspective. Why don’t you start a wiki page at [rubygarden.org](http://rubygarden.org), with the  
> > things that mystify you? The list can fill in the answers, and it’d be a  
> > valuable resource for other newcomers.
> 
> I would like to post a serie of questions, and we can make it complete  
> collaboratively. But I am sorry that I don’t know what is wiki at all. I  
> read the rubygarden,org page, I found that if I post question there, it  
> will be similar to rubytalk archive, which is not very easy to index,  
> and search. Any suggestion?
> 
> Shannon

---

<div class="post-metadata">

### Author: ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)
#### Post date: [1 December 2002 11:42 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/8 "2002-12-01T11:42:19Z")

</div>

> [On funny symbols]  
> That would be good fodder for the FAQ as well. A question “What on earth do  
> the following symbols mean…?” would be a good catch-all.
> 
> Gavin

That said, sooner or later, if somebody wants to become any good at Ruby, they  
have to read some book, and then they will understand all the symbols anyway.  
So why not make it sooner?

That said, I still find “class \<\< self” very mystifying.

Gavin

> **···**
>
> From: “Gavin Sinclair” [gsinclair@soyabean.com.au](mailto:gsinclair@soyabean.com.au)

---

<div class="post-metadata">

### Author: ![Shannon\_Fang](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shannon\_Fang](https://rubytalk.org/u/Shannon_Fang)
#### Post date: [1 December 2002 13:11 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/9 "2002-12-01T13:11:31Z")

</div>

Hi Gavin,

> That would be good fodder for the FAQ as well. A question “What on earth do  
> the following symbols mean…?” would be a good catch-all.

I don’t like this kind of index :). A question can only address one  
symbol, what I prefer, from a new user perspective is something like  
following:

\<\<  
Array,  
Date  
Class (inheritance)  
…

:   
Symbol  
\<   
comparison (less than)  
Class (Object based…)

etc. Which is very simple to index and search…

Thanks.  
Shannon

> **···**
>
> On Sun, 1 Dec 2002 19:27:09 +0900 “Gavin Sinclair” [gsinclair@soyabean.com.au](mailto:gsinclair@soyabean.com.au) wrote:

---

<div class="post-metadata">

### Author: ![David\_Alan\_Black1](https://avatars.discourse-cdn.com/v4/letter/d/278dde/32.png) [@David\_Alan\_Black1](https://rubytalk.org/u/David_Alan_Black1)
#### Post date: [1 December 2002 13:18 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/10 "2002-12-01T13:18:44Z")

</div>

Hi –

> Hi all,
> 
> My feeling toward C++, and ruby, and any other language is that when you  
> learn it more, it becomes more cryptic. Ruby is in deed very impressive,  
> powerful, and easy to read. If I write my own program in ruby, I may not  
> use anything like symbol in years, but when I try to read other’s  
> program, I will see it, and then I will try painfully to find out what  
> does that mean, and miserablly failed.

I think that as you become more familiar with the learning resources  
available, you’ll start finding answers more quickly. No one has  
tried to mystify or conceal any of this 🙂

> In fact, after some suggestion here, I read chap 18 “the ruby  
> programming language” again, and found explanation of most cryptic  
> historic symbols borrowed from perl. But it is still hard to lookup in  
> an emergency. In the document it follows a printed format referring to  
> page 202, for example. But HTML help file don’t have page at all.

That’s because it’s an online version of a printed book, and the page  
numbers aren’t included. Not that they couldn’t be… but hey, this  
was a pioneering effort in the area of putting an in-print trade book  
on the Web for free, so there are a few things to work out 🙂

> Hence, what I suggested is a proper index of every sytactic elements in  
> the help file. Bill suggested that the printed version already have that.  
> Why not the online version?

That’s fine – I was only suggesting not unnecessarily labeling Ruby  
as “cryptic” or “mystifying”.

David

> **···**
>
> On Sun, 1 Dec 2002, Shannon Fang wrote:
> 
> –  
> David Alan Black  
> home: [dblack@candle.superlink.net](mailto:dblack@candle.superlink.net)  
> work: blackdav@shu.edu  
> Web: [http://pirate.shu.edu/~blackdav](http://pirate.shu.edu/~blackdav)

---

<div class="post-metadata">

### Author: ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)
#### Post date: [1 December 2002 13:30 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/11 "2002-12-01T13:30:26Z")

</div>

> Hi all,
> 
> My feeling toward C++, and ruby, and any other language is that when you  
> learn it more, it becomes more cryptic. Ruby is in deed very impressive,  
> powerful, and easy to read. If I write my own program in ruby, I may not  
> use anything like symbol in years, but when I try to read other’s  
> program, I will see it, and then I will try painfully to find out what  
> does that mean, and miserablly failed.

You won’t program Ruby for long without using

class Example  
attr\_reader :foo, bar  
…  
end

module Blah  
…  
module\_method :quux  
end

So symbols are just part of Ruby growing pains. I never had any problem with  
them. I happily understood them in attr\_reader without knowing exactly what  
they were. When the time came for me to delve into them, I had online PickAxe  
and dead-tree “Ruby in a Nutshell”. Everyone who’s serious about programming  
Ruby should have at least one book. Online documentation can’t do everything.

Gavin

> **···**
>
> From: “Shannon Fang” [xrfang@hotmail.com](mailto:xrfang@hotmail.com)

---

<div class="post-metadata">

### Author: ![Martin\_DeMello1](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Martin\_DeMello1](https://rubytalk.org/u/Martin_DeMello1)
#### Post date: [1 December 2002 15:22 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/12 "2002-12-01T15:22:53Z")

</div>

A wiki is a world-editable webpage. They’re fun 🙂

[http://www.rubygarden.org/ruby](http://www.rubygarden.org/ruby) for the wiki  
[http://www.rubygarden.org/ruby?Notes\_About\_This\_Site](http://www.rubygarden.org/ruby?Notes_About_This_Site) for how it works  
and  
[http://www.rubygarden.org/ruby?SandBox](http://www.rubygarden.org/ruby?SandBox) for a safe place to experiment

martin

> **···**
>
> Shannon Fang [xrfang@hotmail.com](mailto:xrfang@hotmail.com) wrote:
> 
> > Hi Martin,
> > 
> > On Sun, 1 Dec 2002 17:02:03 +0900 \> Martin DeMello [martindemello@yahoo.com](mailto:martindemello@yahoo.com) wrote:
> > 
> > > This might actually be a lot easier to do from a newcomer’s  
> > > perspective. Why don’t you start a wiki page at [rubygarden.org](http://rubygarden.org), with the  
> > > things that mystify you? The list can fill in the answers, and it’d be a  
> > > valuable resource for other newcomers.
> > 
> > I would like to post a serie of questions, and we can make it complete  
> > collaboratively. But I am sorry that I don’t know what is wiki at all. I  
> > read the rubygarden,org page, I found that if I post question there, it  
> > will be similar to rubytalk archive, which is not very easy to index,  
> > and search. Any suggestion?

---

<div class="post-metadata">

### Author: ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)
#### Post date: [1 December 2002 14:09 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/13 "2002-12-01T14:09:45Z")

</div>

> Hi Gavin,
> 
> > That would be good fodder for the FAQ as well. A question “What on earth  
> > do  
> > the following symbols mean…?” would be a good catch-all.
> 
> I don’t like this kind of index :). A question can only address one  
> symbol, what I prefer, from a new user perspective is something like  
> following:

I respectfully disagree. We can’t have a separate question for each symbol -  
it would result in blowout.

I’ve posted a proposed FAQ entry for feedback, containing your suggestions  
(except class names, which are far from cryptic) and several more. See what  
you think.

Gavin

> **···**
>
> From: “Shannon Fang” [xrfang@hotmail.com](mailto:xrfang@hotmail.com)
> 
> > On Sun, 1 Dec 2002 19:27:09 +0900 \> “Gavin Sinclair” [gsinclair@soyabean.com.au](mailto:gsinclair@soyabean.com.au) wrote:

---

<div class="post-metadata">

### Author: ![Shannon\_Fang](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@Shannon\_Fang](https://rubytalk.org/u/Shannon_Fang)
#### Post date: [1 December 2002 14:23 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/14 "2002-12-01T14:23:29Z")

</div>

Gavin,

> You won’t program Ruby for long without using
> 
> class Example  
> attr\_reader :foo, bar  
> …  
> end
> 
> module Blah  
> …  
> module\_method :quux  
> end
> 
> So symbols are just part of Ruby growing pains. I never had any problem with  
> In deed, we follow nearly the same route, before I knew there’s a class  
> called symbol, there are no growing pains at all!

I thought attr\_reader is a special notation, I never realised that it is  
a method. and :name after attr\_reader is just a special syntax, and  
:name is indeed same as name, but the “:” is required by the attr\_reader  
notation.

After I learned that attr\_reader is a method, and :name is a symbol, and  
:name is not linked to name, my classical word collapsed, and I entered  
a new world of modern ruby… Just like transition to the world of  
Newton to Einstein… 🙂

Shannon

> **···**
>
> On Sun, 1 Dec 2002 22:30:26 +0900 “Gavin Sinclair” [gsinclair@soyabean.com.au](mailto:gsinclair@soyabean.com.au) wrote:

---

<div class="post-metadata">

### Author: ![Martin\_DeMello1](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@Martin\_DeMello1](https://rubytalk.org/u/Martin_DeMello1)
#### Post date: [1 December 2002 15:02 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/15 "2002-12-01T15:02:47Z")

</div>

The following analogy might help: think of a string as a frame in which  
several blocks of movable type are set, and a symbol as a single block  
of metal, engraved with a complete word, and given a serial number which  
is stored in a large list of serial numbers indexed by name, so you can  
find it quickly.

martin

> **···**
>
> Shannon Fang [xrfang@hotmail.com](mailto:xrfang@hotmail.com) wrote:
> 
> > After I learned that attr\_reader is a method, and :name is a symbol, and  
> > :name is not linked to name, my classical word collapsed, and I entered  
> > a new world of modern ruby… Just like transition to the world of  
> > Newton to Einstein… 🙂

---

<div class="post-metadata">

### Author: ![HAL\_9000](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@HAL\_9000](https://rubytalk.org/u/HAL_9000)
#### Post date: [1 December 2002 16:57 UTC](https://rubytalk.org/t/cipher-book-for-ruby/3192/16 "2002-12-01T16:57:53Z")

</div>

🙂 A good feeling, no?

May all your surprises be pleasant ones…

Hal

> **···**
>
> ----- Original Message -----  
> From: “Shannon Fang” [xrfang@hotmail.com](mailto:xrfang@hotmail.com)  
> To: “ruby-talk ML” [ruby-talk@ruby-lang.org](mailto:ruby-talk@ruby-lang.org)  
> Sent: Sunday, December 01, 2002 8:23 AM  
> Subject: Re: Cipher book for ruby
> 
> > I thought attr\_reader is a special notation, I never realised that it is  
> > a method. and :name after attr\_reader is just a special syntax, and  
> > :name is indeed same as name, but the “:” is required by the attr\_reader  
> > notation.
> > 
> > After I learned that attr\_reader is a method, and :name is a symbol, and  
> > :name is not linked to name, my classical word collapsed, and I entered  
> > a new world of modern ruby… Just like transition to the world of  
> > Newton to Einstein… 🙂
