2008/7/23 Shadowfirebird <shadowfirebird / gmail.com>:
> The annoying thing is that my actual code worked "fine" when it was
> all in one file but stopped working when I split the objects into
> different files.

If you write everything in one file, it only works if you define class
Two before class One. If you reverse the definitions, you get the same
error. In Ruby you have to define a constant before you can use it.
This is independent of require.

If you create a file main.rb with

  require "test1"
  require "test2"

the code is working. If you reverse those two lines, you get the
error. This is the same behavior as in the one-file example. I suggest
you add some debugging statements in your code to understand the
sequence when loading files, for example in file test1.rb:

  puts "start test1"
  require "test2"
  puts "before test1.One"
  class One < Two
    puts "in test1.One"
    def self.testone(); Two.whoistwo; end
    def self.whoisone();  puts "class one"; end
  end
  puts "end test1"

or something like this.

Regards,
Pit