From: Daniel Schierbeck Date: 2006-06-11T20:46:32+09:00 Subject: Hash#[] Am I the only one who thinks this would be a natural behavior for Hash#[]? hsh = {:foo => 'FOO', :bar => 'BAR', :baz => 'BAZ'} hsh[:foo] #=> "FOO" hsh[:foo, :baz] #=> ["FOO", "BAZ"] That would enable us to do the following def initialize(opts = {}) @host, @user, @pass = opts[:host, :user, :pass] end Since the old functionality isn't changed, it would be backwards compatible. Implementation: class Hash def [](*keys) if keys.length == 1 fetch(keys.first, nil) else keys.map{|key| fetch(key, nil)} end end end Cheers, Daniel