lib/enumeration/collection.rb in enumeration-1.2.0 vs lib/enumeration/collection.rb in enumeration-1.2.1
- old
+ new
@@ -23,10 +23,10 @@
end
# lookup collection key by a value
def key(value)
if self.map? && @data.has_value?(value)
- @data.index(value)
+ @data.invert[value]
elsif (self.map? && @data.has_key?(value)) ||
(self.list? && @data.include?(value))
value
else
nil