From: "Iñaki Baz Castillo" Date: 2008-09-10T19:21:20+09:00 Subject: How to change the owner of a method in a block? Hi, let me explain with this simple code: -------------------- class A def initialize(&blk) blk.call end def hello puts "HELLO !!!" end end a=A.new { hello() } => block_1.rb:13: undefined method `hello' for main:Object (NoMethodError) from block_1.rb:4:in `call' from block_1.rb:4:in `initialize' from block_1.rb:13:in `new' from block_1.rb:13 --------------------------------- I understand perfectly what occurs: When passing "hello()" in a block, it's like if the current object is "main:Object", for which there is no "hello" method (of course). Well, I'd like that "hello()" would be runned as class A instance method. Is it possible is some ellegant way? Thanks a lot. -- Iñaki Baz Castillo