This seems to work!


class Color
  def initialize (address, color, colorHash)
    @localColor = color
    @localAddress = address
    #colorHash[@localAddress].push(self)
    colorHash.store(@localAddress, self)
  end

  def getColor
    @localColor
  end
end

hashObject = {}

Color.new( "A", "Red", hashObject )
Color.new( "B", "White", hashObject )
Color.new( "C", "Blue", hashObject )

puts hashObject["C"].getColor
puts hashObject["B"].getColor
puts hashObject["A"].getColor


Thanks!

Frank

-- 
Posted via http://www.ruby-forum.com/.