diff options
Diffstat (limited to 'lib/metropolis/multi_hash/to_i.rb')
-rw-r--r-- | lib/metropolis/multi_hash/to_i.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/metropolis/multi_hash/to_i.rb b/lib/metropolis/multi_hash/to_i.rb new file mode 100644 index 0000000..69b2819 --- /dev/null +++ b/lib/metropolis/multi_hash/to_i.rb @@ -0,0 +1,12 @@ +# -*- encoding: binary -*- +# simple "hashing" method which converts keys to integers, +# this may be useful for databases that only store numeric keys +module Metropolis::MultiHash::ToI + def to_i(key) + key.to_i + end + + def to_i_16(key) + key.to_i(16) + end +end |