Kenneth McDonald
9/22/2008 3:42:00 PM
Thanks!
On Sep 22, 2008, at 10:08 AM, Robert Klemme wrote:
> 2008/9/22 Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net>:
>> Ruby has an abstract File/path type which is nice (I'm mainly a
>> Python user
>> and it doesn't), but it doesn't seem to provide object-oriented
>> methods to
>> combine file paths, i.e. I can't go path3 = path1/path2 or something
>> similar. Instead, I have to use the join function, which is much less
>> elegant, IMHO. Am I missing something. Has someone written an
>> extension to
>> File that adds such path operations?
>
> irb(main):001:0> require 'pathname'
> => true
> irb(main):002:0> pn = Pathname.new '.'
> => #<Pathname:.>
> irb(main):003:0> pn.absolute?
> => false
> irb(main):004:0> pn + "foo" + "bar"
> => #<Pathname:foo/bar>
>
> Cheers
>
> robert
>
>
> --
> use.inject do |as, often| as.you_can - without end
>