Skip to content
Permalink
Browse files

Added Hash#invert

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 9, 2013
1 parent 9c3e2d7 commit e4bad6ddeb5fae24d4f1b0841a0d9bd0a381cbd3
Showing with 8 additions and 4 deletions.
  1. +8 −0 lib-topaz/hash.rb
  2. +0 −4 spec/tags/core/hash/invert_tags.txt
@@ -96,6 +96,14 @@ def values_at(*keys)
keys.map { |k| self[k] }
end

def invert
res = {}
each do |k, v|
res[v] = k
end
res
end

def inspect
result = "{"
recursion = Thread.current.recursion_guard(:hash_inspect, self) do

This file was deleted.

0 comments on commit e4bad6d

Please sign in to comment.
You can’t perform that action at this time.