Method: Multimap#index
- Defined in:
- lib/multimap.rb
#index(value) ⇒ Object
call-seq:
map.index(value) => key
Returns the key for a given value. If not found, returns nil.
map = Multimap["a" => 100, "b" => [200, 300]]
map.index(100) #=> "a"
map.index(200) #=> "b"
map.index(999) #=> nil
301 302 303 |
# File 'lib/multimap.rb', line 301 def index(value) invert[value] end |