From: Chris Bailey Date: 2008-08-29T10:29:37+09:00 Subject: NoMethodError ? In the following code I am trying to print out the value of the variable @symbol from an array of instances of the MapSector class. I don't understand why I'm getting "NoMethodError: undefined method `symbol' for #" after putting this in irb and typing: foo = GameMap.new(5,5) foo.show_map class GameMap attr_accessor :height, :width, :id, :sectors def initialize height, width @height = height @width = width @id = nil @sectors = Array.new(@height, MapSector.new) {Array.new(@width, MapSector.new)} end def show_map @sectors.each do |x| puts x.symbol end end end class MapSector attr_accessor :type, :symbol, :players def initialize @type = "plains" @players = [] @symbol = "." end end -- Posted via http://www.ruby-forum.com/.