Skip to content

Instantly share code, notes, and snippets.

@pixie79
Created June 2, 2014 20:01
Show Gist options
  • Save pixie79/5e97ad7f8ae0c01eb5fc to your computer and use it in GitHub Desktop.
Save pixie79/5e97ad7f8ae0c01eb5fc to your computer and use it in GitHub Desktop.
ruby to hash
#!/usr/bin/env ruby
X = ["name", "rm", "ip", "127.0.0.1", "port", "6379", "name", "rz", "ip", "127.0.0.1", "port", "6379"]
h = Hash[X.each_slice(2).to_a]
print h['name']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment