Created
June 29, 2010 18:36
-
-
Save greenplastik/457598 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's say I have this the following array of strings that are usually dynamically created: | |
array = ["one", "two", "three", "four", "five"] | |
# I would like to to use this array to create the following hash, using the items from the array as the keys and then also using them to set the value by referencing another hash, as follows: | |
hsh = {"one" => some_other_hash[:one], "two" => some_other_hash[:two], "three" => some_other_hash[:three], "four" => some_other_hash[:four], "five" => some_other_hash[:five]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment