Skip to content

Instantly share code, notes, and snippets.

@yellow5
Created November 1, 2011 05:16
Show Gist options
  • Save yellow5/1329983 to your computer and use it in GitHub Desktop.
Save yellow5/1329983 to your computer and use it in GitHub Desktop.
Working example converting array of string with single divider to hash
string_array = %w( key1=val1 key2=val2 key3=val3 )
some_hash = {}
string_array.each do |array_element|
key,val = array_element.split('=')
some_hash[key.to_sym] = val
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment