From: Dipesh Gtm Date: 2012-08-27T23:12:38+09:00 Subject: Re: Finding methods inside a scope Sorry, I should have posted more code. The code below does not work but I think you will get the idea. class Food def plate(&block) extend Operators include Operations instance_eval(&block) end plate do eat do |d| d.pepsi, 20 d.coke, 10 end end end module Operations attr_accessor :bloc def serve(&block) @bloc[:serve] = block end def eat(&block) @bloc[:eat] = block end end module Operators def serve! @bloc[:serve].call(self) end end Then, when I do Food.new.serve! I wanted it to trigger the pepsi and coke methods on instance level with corresponding arguments. I have not included those methods here though. I wanted to define my methods inside the Operations module via method missing. But since it was extended, I was looking for a scope to tie up to. But, I got it wrong there. Later, I got around it by doing something like: class Food def plate(&block) @current_scope = __method__ instance_eval(&block) @current_scope = nil end end module Operations def method_missing(m,*a,&b) if @current_scope == :plate @bloc[:m] = b else super end end end Hope that made sense. And Thanks. If you guys say there's a better way available, I would be happy to post the working code. -- Posted via http://www.ruby-forum.com/.