Created
November 15, 2010 03:33
-
-
Save gpherguson/700004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Dungeon | |
@@levels = [] | |
def add_level(n, h, w) | |
@@levels[n] = Level.new(h, w) | |
end | |
end | |
class Level | |
def initialize(height, width) | |
@height, @width = height, width | |
end | |
end | |
#/home/lewis/code/ruby/map.rb:4:in `add_level': undefined method `[]=' for nil:NilClass (NoMethodError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
changed @levels to a class variable @@levels