class MyHash < ::Hash def [] keys if keys.kind_of?(Array) keys.inject(self) { |memo, key| memo[key] } else super(keys) end end end