From: Peter Hickman Date: 2001-09-01T03:09:42+09:00 Subject: [ruby-talk:20635] Passing procedures I am building this class that takes a user defined procedure and then applies it. The test code looks like this: class TestClass def initialize(&process) @process = process end def run() if @process == nil then puts "No process given" else @process.call(self, "this", "that") end end end def testfunc(a, b) puts "1 -> #{a} 2 -> #{b}" end fred = TestClass.new(testfunc) fred.run I am expecting the message "1 -> this 2 -> that", what I get is: test.rb:19:in `testfunc': wrong # of arguments(0 for 2) (ArgumentError) from test.rb:19 The problem is the fred = TestClass.new(testfunc) line. It will work if I put in some parameters but I want the parameter values set when it is called inside the class, if I declare them on line 19 then I only get those values back. Any ideas?