Symbols as part of Pathname path construction

14 views
Skip to first unread message

bitherder

unread,
Oct 25, 2011, 5:29:17 AM10/25/11
to facets-u...@googlegroups.com
I'd like to be able to do the following:

  Pathname.root /:usr/:local/:bin 
    => #<Pathname:/usr/local/bin>

The most obvious way for me to do this would be to alias Symbol#to_str to Symbol#to_s (in 1.8) and/or Symbol#to_path to Symbol#to_s (1.9).

I'd be happy to contribute this extension to Facets.

What do you think of my (straw-man) proposal?

Any suggestions for a better implementation approach?


Thanks

Gavin Sinclair

unread,
Nov 6, 2011, 6:31:52 PM11/6/11
to facets-u...@googlegroups.com
On Tuesday, October 25, 2011 8:29:17 PM UTC+11, bitherder wrote:
I'd like to be able to do the following:

  Pathname.root /:usr/:local/:bin 
    => #<Pathname:/usr/local/bin>


I think it looks poor compared to the normal

   Pathname.root "/usr/local/bin"

(Not that I know what "root" does, but that's just me...)

I can see some (minor) potential benefit in your proposal where dynamic pathname construction is concerned, but not enough benefit to justify this feature.

Just my opinion,
Gavin
Reply all
Reply to author
Forward
0 new messages