I run into this all the time writing Mongo queries for MongoMapper. I end
up just using the hash rocket syntax always


On Wed, Jul 9, 2014 at 1:23 PM, Arup Rakshit <aruprakshit / rocketmail.com>
wrote:

> <doco> http://www.ruby-doc.org/core-2.1.0/Hash.html
>
> Hashes allow an alternate syntax form when your keys are always symbols.
> Instead of
>
> options = { :font_size => 10, :font_family => "Arial" }
> You could write it as:
>
> options = { font_size: 10, font_family: "Arial" }
>
> Really ? :-)
>
> Let me see :-
>
> arup@linux-wzza:~/Ruby> pry
> [1] pry(main)> { :$foo => 12 }
> => {:$foo=>12}
> [2] pry(main)> { $foo: 12 }
> SyntaxError: unexpected ':', expecting =>
> { $foo: 12 }
>        ^
> [2] pry(main)>
>
> Doco is not complete. It says use the old syntax, which is always safe.
>
> --
> ================
> Regards,
> Arup Rakshit
> ================
> Debugging is twice as hard as writing the code in the first place.
> Therefore,
> if you write the code as cleverly as possible, you are, by definition, not
> smart enough to debug it.
>
> --Brian Kernighan
>