# Finding help

**URL:** <https://www.ruby-forum.com/t/finding-help/85054>\
**Category:** Ruby\
**Created:** [February 9, 2007, 4:05pm UTC](https://www.ruby-forum.com/t/finding-help/85054 "2007-02-09T16:05:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 4:05pm UTC](https://www.ruby-forum.com/t/finding-help/85054/1 "2007-02-09T16:05:46Z")

</div>

I’m wanting to figure out what the &: syntax does, but I’m not exactly  
sure  
how to search for it given that it contains special characters… a  
search  
on google for “ruby &:” doesn’t really give me anything worth looking  
at,  
and I just checked through the first edition of the Pickaxe (I don’t own  
the  
second edition), and couldn’t find anything in there, either (although,  
sometimes I miss really obvious things, so I suppose it’s possible I  
just  
missed it in there).

If someone could either explain it to me, or point me in the direction  
of  
something that explains it, I would greatly appreciate it.

(And I also tried searching on [ruby-forum.org](http://ruby-forum.org) for &:… it returns  
“Application Error”)

Thanks.

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 4:09pm UTC](https://www.ruby-forum.com/t/finding-help/85054/2 "2007-02-09T16:09:05Z")

</div>

Luke I. wrote:

> I’m wanting to figure out what the &: syntax does, but I’m not exactly  
> sure  
> how to search for it given that it contains special characters… a  
> search  
> on google for “ruby &:” doesn’t really give me anything worth looking  
> at,  
> and I just checked through the first edition of the Pickaxe (I don’t own  
> the  
> second edition), and couldn’t find anything in there, either (although,  
> sometimes I miss really obvious things, so I suppose it’s possible I  
> just  
> missed it in there).
> 
> If someone could either explain it to me, or point me in the direction  
> of  
> something that explains it, I would greatly appreciate it.
> 
> (And I also tried searching on [ruby-forum.org](http://ruby-forum.org) for &:… it returns  
> “Application Error”)
> 
> Thanks.

And, I think I just figured it out… it’s using a symbol to reference a  
function, and an & to turn it into a block? Then you can send a  
function (wrapped in a closure) to another function expecting a block?

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 4:10pm UTC](https://www.ruby-forum.com/t/finding-help/85054/3 "2007-02-09T16:10:47Z")

</div>

On 2/9/07, Luke I. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> (And I also tried searching on [ruby-forum.org](http://ruby-forum.org) for &:… it returns  
> “Application Error”)
> 
> Thanks.

Hi Luke,  
The &: syntax is the famous Symbol#to\_proc hack. The & operator calls  
#to\_proc on the object it is connected to, in this case a Symbol.  
This isn’t in Ruby core, but it is in Rails, and a bunch of extension  
frameworks. Essentially it takes the first argument passed to it, and  
runs the method that was passed in symbol form.

[http://sn.oplo.ws/index.php?title=Symbol#to\_proc](http://sn.oplo.ws/index.php?title=Symbol#to_proc)

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/finding-help/85054/4 "2007-02-09T16:16:47Z")

</div>

You might find this blog helpful:

> **[Ruby: Invoking a method with a ampersand-parameter](http://blog.jayfields.com/2007/01/ruby-invoking-method-with.html)**
>
> On a few ocassions recently I've been asked what the & does when it is used in the context of a method invocation parameter. For example, co...

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 4:17pm UTC](https://www.ruby-forum.com/t/finding-help/85054/5 "2007-02-09T16:17:48Z")

</div>

btw, for further searches you should also check out the Ruby kitchen  
sink:

[http://rubykitchensink.ca/](http://rubykitchensink.ca/)

It searches Ruby/Rails pages only (currently about 10.000 of them, and  
still growing) so it might give you more relevant results.

Cheers,  
Peter

\_\_  
[http://www.rubyrailways.com](http://www.rubyrailways.com) :: Ruby and Web2.0 blog  
[http://scrubyt.org](http://scrubyt.org) :: Ruby web scraping framework

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/finding-help/85054/6 "2007-02-09T17:00:58Z")

</div>

> This isn’t in Ruby core, but it is in Rails, and a bunch of extension  
> frameworks.

Is there a specific reason for this (it not being in core)? It seems  
like a quite useful functionality, and, although I am admittedly rather  
new at this, I don’t see what problems it would cause to include it.

Man… I understand exactly what a lambda is now, I understand inject’s  
usefulness better, and I had no idea that doing ‘&’ called  
.to\_proc

Sweet.

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 4:57pm UTC](https://www.ruby-forum.com/t/finding-help/85054/7 "2007-02-09T16:57:56Z")

</div>

Chris C. wrote:

> On 2/9/07, Luke I. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > (And I also tried searching on [ruby-forum.org](http://ruby-forum.org) for &:… it returns  
> > “Application Error”)
> > 
> > Thanks.
> 
> Hi Luke,  
> The &: syntax is the famous Symbol#to\_proc hack. The & operator calls  
> #to\_proc on the object it is connected to, in this case a Symbol.  
> This isn’t in Ruby core, but it is in Rails, and a bunch of extension  
> frameworks. Essentially it takes the first argument passed to it, and  
> runs the method that was passed in symbol form.
> 
> [http://sn.oplo.ws/index.php?title=Symbol#to\_proc](http://sn.oplo.ws/index.php?title=Symbol#to_proc)

Wow.

I just had one of those moments where a minor little thing causes a  
gigantic shift in my perceptions. That is just freakin cool!

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 5:15pm UTC](https://www.ruby-forum.com/t/finding-help/85054/8 "2007-02-09T17:15:41Z")

</div>

Florian F. wrote:

> Luke I. wrote:
> 
> > Is there a specific reason for this (it not being in core)?
> 
> It’s in 1.9.

Much obliged.

Is there a ruby core timeline I can look at (ie. when they plan on  
releasing new minor and/or major versions), or is it just kind of mutual  
decision by core comitters at any given time?

---

<div class="post-metadata">

**Author:** ![technodolt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e99b99/32.png) [@technodolt](https://www.ruby-forum.com/u/technodolt)\
**Post date:** [February 9, 2007, 5:10pm UTC](https://www.ruby-forum.com/t/finding-help/85054/9 "2007-02-09T17:10:54Z")

</div>

Luke I. wrote:

> Is there a specific reason for this (it not being in core)?

It’s in 1.9.
