From: "Mauricio Fernández" Date: 2004-04-24T03:58:46+09:00 Subject: Re: Modules & include On Sat, Apr 24, 2004 at 03:34:08AM +0900, Andreas Schwarz wrote: > Why do I get an exception? Shouldn't Mod2 have the method return_true > because it included Mod1? > > irb(main):001:0> module Mod1 > irb(main):002:1> def return_true > irb(main):003:2> true > irb(main):004:2> end > irb(main):005:1> end > => nil > irb(main):006:0> module Mod2 > irb(main):007:1> include Mod1 ======= extend > irb(main):008:1> def self.test ========= if this were def test, include Mod1 would do what you want (or the other way around, you'd want what include Mod1 does ;) > irb(main):009:2> return_true > irb(main):010:2> end > irb(main):011:1> end > => nil > irb(main):012:0> Mod2.test > NameError: undefined local variable or method `return_true' for Mod2:Module -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com LILO, you've got me on my knees! -- David Black, dblack@pilot.njin.net, with apologies to Derek and the Dominos, and Werner Almsberger