Okay, I’ve been using ruby for a while now and I really like it, so don’t flame me. BUT! Ruby appears to be a single pass parser. This means if you have a class that uses another class in the same file, you have to define them in the correct order. Yeah, this is something that most languages have fixed a long time ago using a two pass parsing strategy where you collect the symbols in the first pass and then verify and compile in the second pass (or some variation on that). So, I’m annoyed a bit at Ruby for missing the boat on that one. Hopefully they fix this.
One solution is to define the class is a separate file and use a require to include that. This seems to be the best solution at the moment and will support modules as well, but really Ruby should handle both types of declarations regardless of ordering if they intend to let you define multiple classes in a single file.