Marnen Laibow-Koser wrote:
> Fritz Trapper wrote:
>> I see, my scenario is somewhat more complicated, than I wrote in my 
>> initial posting. The point is, that I want to pass an object and a 
>> method.
>> 
>> Something like this:
>> 
>> def executer(obj, method)
>>    f.method(1)
>> end
>> 
>> class x
>>    def test(x)
>>       p x
>>    end
>> end
>> 
>> o = x.new
>> executer(o, test)

Then you can use instance_method(), which is like method() except it 
returns an *unbound* method:

  def executer(obj, unbound_method)
    unbound_method.bind(obj).call(1234)
  end

  class X
    def test(x)
      p x
    end
  end

  o1 = X.new
  o2 = X.new
  o3 = X.new
  method = X.instance_method(:test)

  executer(o1, method)
  executer(o2, method)
  executer(o3, method)
-- 
Posted via http://www.ruby-forum.com/.