lib/ext/array.rb in fathom-0.3.7 vs lib/ext/array.rb in fathom-0.5.0

- old
+ new

@@ -1,5 +1,9 @@ class Array - def rand - self[Kernel.rand(self.length)] + def invert(&block) + h = {} + self.each_with_index do |x, i| + h[x] = block ? yield(x, i) : i + end + h end end