AutoArray

An Array that automatically expands dimensions as needed.

  a  = Autoarray.new
  a[1][2][3] = 12
  a             #=> [nil, [nil, nil, [nil, nil, nil, 12]]]
  a[2][3][4]    #=> []
  a             #=> [nil, [nil, nil, [nil, nil, nil, 12]]]
  a[1][-2][1] = "Negative"
  a             #=> [nil, [nil, [nil, "Negative"], [nil, nil, nil, 12]]]

Authors

  • Brian Schröder

License

  Copyright (c) 2005 Brian Schröder

  Ruby License

  This module is free software. You may use, modify, and/or redistribute this
  software under the same terms as Ruby.

  This program is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  FOR A PARTICULAR PURPOSE.