From: Carlos Date: 2001-09-09T23:57:09+09:00 Subject: [ruby-talk:21020] Method parameter Hi all! Excuse me for the newbie question, but this I couldn't figure how to do, and didn't find in the documentation: I have an object with a method that receives a function. How can I pass the function to the method without enclosing it in a block? def MyClass ... def set_fn (&fn) @fn=fn end def calculate @res=@fn.call(@var1, @var2) end end def my_fn (arg1, arg2) arg1 + arg2 end my_object=MyClass.new my_object.set_fn &my_fn # ERROR: wants to call my_fn my_object.set_fn { |a, b| my_fn(a, b) } # OK! Can I avoid using the block? Thanks in advance! _________________________________________________________ �Lo probaste? Correo gratis y para toda la vida en http://correo.yahoo.com.ar