Class Judy::JudyHash
In: judy.rb
Parent: Object

A JudyHash is intended as a drop-in replacement for Ruby's Hash; that is, the keys can be of any type (not only integers or strings) and it still uses the keys' hash method to compute a hash code. This is an implementation of the ideas set out in the Judy application note "Scalable Hashing" (www.sourcejudy.com/application/Judy_hashing.pdf). For reasons I have not yet determined, JudyHash's performance is not as good as Ruby's Hash, but I suspect this is my (Lyle's) fault and doesn't indicate a flaw in Judy itself ;)

Methods
[]    []=    clear    delete    each    each_key    each_pair    each_value    empty?    free_array    has_key?    keys    length    new    size    to_a    to_s    values   
Public Class methods
new()

Construct an empty hash

Public Instance methods
[]=(key, value)

Insert a key and value into the array. If key is already present, replace the old value with value.

delete(key)

Delete key from the array and return the value previously stored for that key (or nil if this key is not present).

[](key)

Return the value stored for key (or nil if the key is not present).

free_array()

Free the entire array and return the number of bytes freed.

has_key?(key)

Return true if the given key is present, otherwise false.

each()

Call block once for each key present, passing the key and value as parameters. Returns a reference to the array.

each_key()

Call block once for each key present, passing the key as parameter. Returns a reference to the array.

each_pair()

Alias for each.

each_value()

Call block once for each key, passing the value as parameter. Returns a reference to the array.

clear()

Remove all key-value pairs from the array and return a reference to the array.

empty?()

Return true if array contains no keys, otherwise false.

keys()

Return a new array populated with the keys from this hash. See also values.

values()

Return a new array populated with the values from this hash. See also keys.

length()

Return the number of key-value pairs in the array.

size()

Alias for length.

to_a()

Convert this hash to a nested array of [key, value] arrays.

to_s()

Convert this hash to a string by converting it to an Array of [key, value] pairs and then converting that array to a string using Array#join with the default separator.