transfire / gmail.com wrote:
> I find myself always using File.join, and never utilizing Pathname b/c
> it's not as convenient to construct. This snippet occured to me to make
> it more paletable:
> 
>  class String
>     def /(dir)
>       Pathname.new( File.join(self,dir) )
>     end
>   end
> 
>   class Pathname
>     def /(dir)
>       join(dir)
>     end
>   end
> 
>   path = '' / 'usr' / 'local'  #=> #<Pathname:/usr/local>

What about

path = Pathname[''] / 'usr' / 'local'  #=> #<Pathname:/usr/local>

A bit more palatable (?) without affecting String.

I wonder why Pathname.[] and Pathname#/ are not defined this way? The 
former seems safe and conservative, at least. Maybe #/ is not defined 
because #+ already has that behavior and it would be strange for + and / 
  to be the same.

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407