From: David Alan Black Date: 2001-12-09T03:40:28+09:00 Subject: [ruby-talk:27959] Re: Module and object extend. Can someone please explain Hi -- On Sun, 9 Dec 2001, Jim Freeze wrote: > On Sun, 9 Dec 2001, David Alan Black wrote: > > > I don't think #extend will give you access to constants defined > > in a module: > > > Interesting. It will add the constants and they can > be accessed view the methods, but you cannot access the > constants directly. Anyone know why? > > module M > C = 2 > def c > puts C > end > end > class A; end > a=A.new > a.extend M > a.c # => 2 Isn't it just that method c is defined in a context where C is in scope? David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav