Advertisement
ygamretuta

Ruby: Convert Array to Hash with same key:value

Sep 11th, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.10 KB | None | 0 0
  1. a = (big, bottle)
  2. Hash[a.each.map{|value|[value, value]}]
  3. => {'big' => 'big', 'bottle' => 'bottle'}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement