I found the following useful
include Curses
DISPATCH = Hash.new(:beep)
DISPATCH[?A] = :abort # abort
DISPATCH[?h] = :key_help # show help
# ...
DISPATCH[?z] = :undo # undo previous move
for implementing a keystroke command dispatch table.
Regards, Morton
On Jul 14, 2006, at 9:02 PM, transfire / gmail.com wrote:
> Is this form of Hash initialization really very useful?
>
> Hash.new(obj) => aHash
>
> If _obj_ is specified, this single object will be used for all
> _default values_.