You're just missing one character:
[1,2,3].send(:collect, &Proc.new{|x| x.to_s + "!"})
& will pass that proc object in as a block to the method.
--
Ben Hughes
http://benhugh.es/
On Mon, Jan 31, 2011 at 4:50 PM, Xavier Lange <[email protected]> wrote:
> I'm building a HTML extractor on top of nokogiri which applies a
> collection of CSS search strings and more to build a logical
> extraction of data and I wanted to use something like this:
>
> [1,2,3].send(:collect,Proc.new{|x| x.to_s + "!"})
>
> This fails. Any ideas how I could work around this? How do you use
> Object#send (or similar) with a block?
>
> Xavier
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
>
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby