Hi all,
module A
end
A.autoload(:B, "b")
result :
uninitialized constant A::B (NameError)
Hi all,
module A
end
A.autoload(:B, "b")
result :
uninitialized constant A::B (NameError)
Do you have a file named "b"?
On 7/19/07, Chung Chung <bkeh12@gmail.com> wrote:
Hi all,
module A
end
A.autoload(:B, "b")
A::B.doit # autoloads "b"result :
uninitialized constant A::B (NameError)
Todd Benson wrote:
On 7/19/07, Chung Chung <bkeh12@gmail.com> wrote:
Hi all,
module A
end
A.autoload(:B, "b")
A::B.doit # autoloads "b"result :
uninitialized constant A::B (NameError)Do you have a file named "b"?
Hi,
Yes, I have.
A.autoload?(:B) # "b"
--
Posted via http://www.ruby-forum.com/\.
Chung Chung wrote:
Todd Benson wrote:
Hi all,
module A
end
A.autoload(:B, "b")
A::B.doit # autoloads "b"result :
uninitialized constant A::B (NameError)Do you have a file named "b"?
Hi,
Yes, I have.
A.autoload?(:B) # "b"
irb(main):001:0> module A
irb(main):002:1> end
=> nil
irb(main):003:0> A.autoload(:B,"b")
=> nil
irb(main):004:0> A.autoload?(:B)
=> "b"
irb(main):005:0> A::B.hello
NameError: uninitialized constant A::B
from (irb):5
irb(main):006:0> require "b"
=> false
irb(main):007:0> B.hello
"hello"
=> nil
Hi,
At Fri, 20 Jul 2007 10:12:47 +0900,
Chung Chung wrote in [ruby-talk:260876]:
irb(main):006:0> require "b"
=> false
irb(main):007:0> B.hello
"hello"
=> nil
Seems b.rb defines ::B but doesn't A::B.
--
Nobu Nakada