From: Rob Biedenharn Date: 2011-04-05T05:56:07+09:00 Subject: Re: Using grep on subarrays - help! On Apr 4, 2011, at 4:05 PM, Simon Harrison wrote: > Thanks Rob,very useful. Any chance of expanding on this at all: > > "a quick, single block > arg" (as in arry.map{|_|_.something} to mean the same as > arry.map(&:something) without needing Symbol#to_proc)." > > -- > Posted via http://www.ruby-forum.com/. > Here's a little example from an error handler in a script (first occurrence in an open buffer): rescue => e if $stderr.isatty $stderr.puts e.message $stderr.puts e.backtrace.select {|_| %r{/app/} =~ _}.join("\n\t") else raise end end While I could replace the "_" with a name like "line" or "backtrace_line", that doesn't really increase the expressiveness when the entire block is one statement/expression. -Rob Rob Biedenharn Rob@AgileConsultingLLC.com http://AgileConsultingLLC.com/ rab@GaslightSoftware.com http://GaslightSoftware.com/