Skip to content

Instantly share code, notes, and snippets.

@ukitazume
Created February 14, 2012 15:23
Show Gist options
  • Select an option

  • Save ukitazume/1827532 to your computer and use it in GitHub Desktop.

Select an option

Save ukitazume/1827532 to your computer and use it in GitHub Desktop.
[:aa, :bb, :cc].map(&:to_s) #=> ["aa", "bb", "cc"]
{:aa => 'aa', :bb => 'bb'}.map(&:to_s) #=> ["aaaa", "bbbb"]
ary = {:aa => 'aa', :bb => 'bb'}.map do |key, value|
[key.to_s, value]
end
Hash[ary] #=> {"bb"=>"bb", "aa"=>"aa"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment