M
Michael Judge
It's been yet another late Friday. It's practically a lifestyle by this
point. (I'm glad my wife understands.) So anyway, things were going
fine until I tried to get two ruby files to require each other.
Suddenly the class defined in the first file was considered
"uninitialized."
Here's some code demonstrating the error:
Type into IRB:
require "a"
NameError: uninitialized constant A
from ./b.rb:3
from ./a.rb:1
from (irb):3
Place these files in the same directory you call irb in:
File a.rb
require "b"
class A < Array
# Do nothing
end
File b.rb
require "a"
class B < A
# Do nothing
end
Where's the brutally obvious mistake I made? Why would A be an
uninitialized constant?
point. (I'm glad my wife understands.) So anyway, things were going
fine until I tried to get two ruby files to require each other.
Suddenly the class defined in the first file was considered
"uninitialized."
Here's some code demonstrating the error:
Type into IRB:
require "a"
NameError: uninitialized constant A
from ./b.rb:3
from ./a.rb:1
from (irb):3
Place these files in the same directory you call irb in:
File a.rb
require "b"
class A < Array
# Do nothing
end
File b.rb
require "a"
class B < A
# Do nothing
end
Where's the brutally obvious mistake I made? Why would A be an
uninitialized constant?