From: James Moore Date: 2006-12-17T16:35:59+09:00 Subject: Re: method_missing question > So anyway, here's a starting point. The trick is to use instance_eval > to change the value of 'self' within the block. > More straightforward to grab the block, make it a method of the current object, then call that method? require 'pp' class ReadableThing def book &block ugly_call_to_get_the_eigenclass = class << self; self; end ugly_call_to_get_the_eigenclass.send :define_method, :___secret_method, block send :___secret_method end def title pp 'a title' end end r = ReadableThing.new r.book do puts "self is: #{self.inspect}\n" title end C:\rx\rv\bin>ruby r.rb self is: # "a title" It does leave a reference to the block lying around - you'd probably want to clean that up for production code. -- James Moore