From: Alber Eric Date: 2006-12-16T01:00:16+09:00 Subject: Re: using Proc and yield OK, thank you for your quick answer I will just expose what I'm trying to do : I have four differents methods that are yielding strings. I want to use one or the other depending on the context but the rest of the process is the same, so I wrote something like that p1 = nil p2 = nil # First argument handling case arg1 when 1 p1 = Proc.new { methodI { |s| yield s } } when 2 p1 = Proc.new { methodII { |s| yield ("foo-" + s + "-bar") } } end # Second argument handling case arg2 when 3 p2 = Proc.new { methodIII { |s| yield s } } when 4 p1 = Proc.new { methodIV { |s| yield ("oof-" + s + "-rab") } } end p1.call { |i| p2.call { |j| process(i) } } What I'm looking for is a sort of function pointer. Thanks Eric -- Posted via http://www.ruby-forum.com/.