From: Nasir Khan Date: 2007-08-27T09:59:37+09:00 Subject: if assignment is a method call ------=_Part_178045_27015671.1188176374463 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Given an object x, if you invoke x.y = 1 then this will work if the object has an attribute y and is writable (or you have defined a method y= ) If that is not the case then you will get a NoMethodError. You can override the method_missing() method and capture this. When you invoke a method on an object you can also attach a block to the invocation. e.g object.method(arg1, arg2) { puts "in the block" } Furthermore when a method_missing is invoked for missing method the block is available to it - method_missing(m,*a, &block). Now the question is that though y= behaves like a method and is captured by the method_missing as well, there is no way to provide a block to the method call. x.y=(1) { puts "in the block"} is actually a compile error. irb(main):005:0* x.y=(1) { puts "in the block"} SyntaxError: compile error (irb):5: syntax error, unexpected '{', expecting $end x.y=(1) { puts "in the block"} Is there a way to pass a block to the assignment? Thanks Nasir ------=_Part_178045_27015671.1188176374463--