Lately I was developing some code using Backbone.js and Coffeescript, and got pretty much used to Coffeescripts built in methods to access stuff passed as objects:
{ firstname, lastname, @email } = options
Which is equivalent of:
firstname = options.firstname
lastname = options.lastname
@email = options.email
Question
Is there any built in Ruby syntax for achieving same behaviour on Ruby's hashes?
What I've managed to achieve so far is this:
firstname, lastname, @email = params.values_at(:firstname, :lastname, :email)
But it isn't a 1:1 solution of problem.
Edit #1
JS generated by Coffeescript:
var firstname, lastname;
firstname = options.firstname, lastname = options.lastname, this.email = options.email;