why is not work ?

C

Chung Chung

Hi all,

module A
end
A.autoload:)B, "b")
A::B.doit # autoloads "b"

result :
uninitialized constant A::B (NameError)
 
C

Chung Chung

Chung said:
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
 
N

Nobuyoshi Nakada

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top