The well-cited RIP Hash rocket post would seem to imply the Hash Rocket syntax (:foo => "bar"
) is deprecated in favor of the new-to-Ruby JSON-style hash (foo: "bar"
), but I can't find any definitive reference stating the Hash Rocket form is actually deprecated/unadvised as of Ruby 1.9.
相关问题
- What does an “empty line with semicolon” mean in C
- facebook error invalid key hash for some devices
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- Bcrypt vs Hash in laravel
- uninitialized constant Mysql2::Client::SECURE_CONN
The author of that blog post is being overly dramatic and foolish, the
=>
is still quite necessary. In particular::'where.is' => x
is valid but'where.is': x
is not. Ruby 2.2 has fixed this problem so you can say'where.is': x
in Ruby 2.2+.:$set => x
is valid but$set: x
is not. In Ruby 2.2+ you can get around this problem with quotes:'$set': x
will do The Right Thing.'s' => x
is valid but's': x
is something completely different.You can kludge around the above in the obvious manner of course:
but that's just ugly and unnecessary.
The rocket isn't going anywhere without crippling Ruby's Hashes.