7
7stud --
Hi,
In the code:
h = Hash.new {|hash, key| hash[key] = []}
what method is yielding the values hash, key to the code block? It
doesn't seem like it could be new() since new() isn't called when you
lookup a key in a hash. Does new() somehow associate that block with
the method [] in Hash?
Thanks.
In the code:
h = Hash.new {|hash, key| hash[key] = []}
what method is yielding the values hash, key to the code block? It
doesn't seem like it could be new() since new() isn't called when you
lookup a key in a hash. Does new() somehow associate that block with
the method [] in Hash?
Thanks.