furtive.clown / gmail.com wrote: >>> It was only a coincidence that you found an Array method which >>> corresponded to the operation in the block, namely Array#concat. > filename = File.basename(input.map { |t| > t.gsub(re, "_") > }.join) > > filename = input.map { |t| > t.gsub(re, "_") > }.join.as { |t| > File.basename(t) > } > > I greatly prefer the latter. I want to chain, chain, chain, and I > don't want pesky prefix-y function calls like File.basename() to cramp > my style. It wasn't entirely a coincidence that JEGII found concat - it's the sort of thing that is often needed with arrays. The underlying problem in your example is that filename operations aren't object- oriented, so you wind up using a method-call on a class... yuk. This is a weakness in the standard classes - there should be a Filename class, and a String#to_filename method, so your example becomes: filename = input.map { |t| t.gsub(re, "_") }.join.to_filename.base No need for Object#as in that. There are other use cases of course, and I also might use "as" sometimes myself. Clifford Heath.