Pathname

Hm, I suppose I could do that. :slight_smile:

Thanks,

Dan

This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

···

-----Original Message-----
From: Logan Capaldo [mailto:logancapaldo@gmail.com]
Sent: Tuesday, May 30, 2006 10:17 AM
To: ruby-talk ML
Subject: Re: Pathname

On May 30, 2006, at 12:55 AM, Daniel Berger wrote:

> Daniel Berger wrote:
>> transfire@gmail.com wrote:
>
> <snip>
>
>>> More importantly, I think it would be nice if there were a
>>> shorter way
>>> to define a path, perhaps a percent literal like %p{a/b}.
>> Good idea. I'm stealing it for pathname2. :slight_smile:
>
> Well, I would have stolen it, except that I forgot that there's no
> way to define % literals in Ruby 1.8 afaik. I'm not sure about 1.9.
>
> Related RCR: RCR 279: User defined % literals
>
> Regards,
>
> Dan
>
>

Well, is this close enough?

module Kernel
   def pn(s)
     Pathname.new(s)
   end
end

pn %{a/b}

It almost looks like a % literal.