# What is the :argument syntax about?

**URL:** <https://www.ruby-forum.com/t/what-is-the-argument-syntax-about/180174>\
**Category:** Ruby\
**Created:** [December 14, 2009, 3:56am UTC](https://www.ruby-forum.com/t/what-is-the-argument-syntax-about/180174 "2009-12-14T03:56:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [December 14, 2009, 3:56am UTC](https://www.ruby-forum.com/t/what-is-the-argument-syntax-about/180174/1 "2009-12-14T03:56:43Z")

</div>

Hi all,

I’ve noticed that for some methods in some gems, it’s necesarry to pass  
arguments like this:

method( :arg1 =\> value, :arg2 =\> value, :arg3,…)

I use the syntax the same way in the examples and it works, but I’d  
like to know what Ruby’s doing under there. What is the : and the =\>  
for anyway? Thanks for any info.

---

<div class="post-metadata">

**Author:** ![tutiplain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tutiplain](https://www.ruby-forum.com/u/tutiplain)\
**Post date:** [December 14, 2009, 4:12am UTC](https://www.ruby-forum.com/t/what-is-the-argument-syntax-about/180174/2 "2009-12-14T04:12:57Z")

</div>

On Dec 13, 2009, at 11:26 PM, Omar C. wrote:

> for anyway? Thanks for any info.  
> It is the same as:

method( {:arg1 =\> value, :arg2 =\> value} )

{a =\> b} is a Hash in Ruby, :something is a Symbol. You can read about  
those everywhere, I will not write yet another introduction.  
Because the parser can easily see that it is a Hash, you can omit the  
{}.

On the other side, it will look like this:

def method(options = {})  
arg1 = options[:arg1]  
arg2 = options[:arg2]  
end

It looks a bit like named arguments and has the same benefits: you can  
reorder them as you like, you immediately know the meaning from the  
argument list and you can omit optional arguments in a nice fashion.

Regards,  
Florian
