Skip to content

Instantly share code, notes, and snippets.

@sergeykish
Created July 13, 2009 17:42
Show Gist options
  • Select an option

  • Save sergeykish/146322 to your computer and use it in GitHub Desktop.

Select an option

Save sergeykish/146322 to your computer and use it in GitHub Desktop.
$ ruby --version
ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux]
>> Hash[[[1, 2], [3, 4]]]
=> {1=>2, 3=>4}
$ ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
>> Hash[[[1, 2], [3, 4]]]
ArgumentError: odd number of arguments for Hash
from (irb):12:in `[]'
from (irb):12
>> Hash[*[[1, 2], [3, 4]].flatten]
=> {1=>2, 3=>4}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment