From: Barun Singh Date: 2009-04-29T10:14:43+09:00 Subject: Re: dynamically calling methods that require a block Ah, right I forgot the ampersand. I needed to be able to define the block separately from the send call, so I tried this: cond = Proc.new {|x| x > 2} a.send(:detect, cond) but I needed that second line to be a.send(:detect, &cond) thanks! Joel VanderWerf wrote: > Barun Singh wrote: >> >> I'm using Ruby 1.8.6 >> >> Thanks.. > > Just pass the block to the send method as you normally would pass a > block: > > a.send(:detect, &proc {|x| x > 2}) > => 3 > a.send(:detect) {|x| x > 2} > => 3 -- Posted via http://www.ruby-forum.com/.