Class FuzzyHash
In: lib/hashery/fuzzyhash.rb
Parent: Object

Fuzzy Hash

A weird hash with special semantics for regex keys.

This is useful when you want to have a lookup table that can either contain strings or regexes. For instance, you might want a catch all for certain regexes that perform a certain logic.

 >> hash = FuzzyHash.new
 >> hash[/^\d+$/] = 'number'
 >> hash[/.*/] = 'something'
 >> hash['chunky'] = 'bacon'
 >> hash['foo'] = 'vader'

 >> hash['foo']
 << 'vader'
 >> hash['food']
 << 'something'
 >> hash['123']
 << 'number'

Copyright (c) 2009 Joshua Hull

Methods

==   []   []=   clear   count   delete_value   each   empty?   keys   match_with_result   new   replace   size   values  

Attributes

fuzz_test  [W] 
fuzzies  [R] 
fuzzies_reverse  [R] 
fuzzy_hash  [R] 
hash  [R] 
hash_reverse  [R] 

Public Class methods

Public Instance methods

count()

Alias for size

[Validate]