No commit activity in last 3 years
No release in over 3 years
Provides a simple modification to existing hashes to provide key lookup by value in addition to value lookup by key. For example: TABLE = { :key => 1 }.extend(WithReverseLookup) TABLE[:key] #=> 1 TABLE[1] #=> :key This is mostly useful for lookup tables.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

With Reverse Lookup

Extends a hash to be able to look up keys by value (for bi-directional hashes).

Sample

table = {
  :foo => "Foo",
  :bar => "Bar",
  :baz => "Baz"
}.extend(WithReverseLookup)

table[:foo]   #=> "Foo"
table["Foo"]  #=> :foo

License

MIT

Copyright

Copyright © 2010 Matt Todd.