On Nov 12, 2007, at 4:35 PM, furtive.clown / gmail.com wrote:

> On Nov 12, 5:25 pm, James Edward Gray II <ja... / grayproductions.net>
> wrote:
>> On Nov 12, 2007, at 4:20 PM, furtive.cl... / gmail.com wrote:
>>
>>> #as is also used to make function calls prettier:
>>
>>> 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 would use:
>>
>>    file_name = File.basename(input.join.gsub(re, "_"))
>>
>
> Not if re has \A or \Z.

If the Regexp contain such an anchor, we probably shouldn't be  
calling gsub().

> In any case you may be missing the point, though.

I may be, sure.  As may you.  ;)

My point is that your examples aren't convincing me.  Even if we have  
to support the anchor, I prefer your first example.  It's more  
obvious to me.  But I'll sleep OK tonight if we just agree to  
disagree on that.

James Edward Gray II