B
Bob Sidebotham
This program runs, and prints "Foo" (as expected).
module Mod
def get
@@var
end
@@var = "Mod" # Removing this causes error
end
class Foo
include Mod
@@var = "Foo"
end
puts Foo.new.get
-------------
But if I remove the commented line, above, then I get:
uninitialized class variable @@var in Mod (NameError)
This is with ruby 1.8.2 (2004-09-10) [i686-linux]
Is this a bug, feature, or am I just missing something?
Thanks,
Bob Sidebotham
module Mod
def get
@@var
end
@@var = "Mod" # Removing this causes error
end
class Foo
include Mod
@@var = "Foo"
end
puts Foo.new.get
-------------
But if I remove the commented line, above, then I get:
uninitialized class variable @@var in Mod (NameError)
This is with ruby 1.8.2 (2004-09-10) [i686-linux]
Is this a bug, feature, or am I just missing something?
Thanks,
Bob Sidebotham