Re: Nesting Includes
- From: Sean O'Halpin <sean.ohalpin@xxxxxxxxx>
- Date: Tue, 15 Nov 2005 11:40:27 +0900
On 11/15/05, listrecv@xxxxxxxxx <listrecv@xxxxxxxxx> wrote:
> Hi. I'd like to include one module, which would include other modules
> into my namespace. Is this doable?
>
> Doing this:
> ----file1.rb
> module AAA
> include bbb
> end
>
> ----file2.rb
> include AAA
>
> does not seem to include bbb. Is there anyway to do this, or do I need
> to add the include explicilty to file2 as well?
>
Hi, you need to require the files you want:
----bbb.rb
module BBB
def bbb
puts "bbb"
end
end
----aaa.rb
require 'bbb'
module AAA
include BBB
end
---- test-nested-includes.rb
require 'aaa'
include AAA
bbb
---- OUTPUT
bbb
Regards,
Sean
.
- References:
- Nesting Includes
- From: listrecv
- Nesting Includes
- Prev by Date: Re: Recursive functions
- Next by Date: using n.times with gsub
- Previous by thread: Nesting Includes
- Next by thread: Re: Nesting Includes
- Index(es):
Relevant Pages
|