From: Neil Stevens Date: 2005-12-06T00:27:35+09:00 Subject: Re: Can I set a module context for a block? John Lam wrote: > I'd really like to be able to inject the 'include Bob' statement in the > create method of Bob: > > module Bob > def method_missing(name, *params) > puts "missing: #{name}" > end > def self.create(name) > yield if block_given? > puts name > end > end > > Bob::create('hi') do > include Bob > ldstr > ldc_i4_0 > end > > Is there a way that I can avoid include Bob in my block? def self.create(name) module_eval do yield end if block_given? puts name end -- Neil Stevens - neil@hakubi.us 'A republic, if you can keep it.' -- Benjamin Franklin