Sean O'Halpin
10/3/2008 7:04:00 AM
On Fri, Oct 3, 2008 at 7:20 AM, Claudio Greco <claudio_greco@yahoo.com> wrote:
> Daniel Berger wrote:
>> Hm, you're right. I was thinking each_entry simply yielded each piece
>> of the path.
>> ...
>> Trying using it in conjunction with
>> File.expand_path and see if that works.
>>
>
> I tried that before starting this thread
>
> Claudio
> --
Try this:
require 'pathname'
path = Pathname.new('Test')
path.each_entry { | f |
p [f, f.exist?, f.expand_path, path.join(f), path.join(f).exist?]
}
# >> [#<Pathname:.>, true, #<Pathname:/Users/ohalps01/scratch>,
#<Pathname:Test>, true]
# >> [#<Pathname:..>, true, #<Pathname:/Users/ohalps01>, #<Pathname:.>, true]
# >> [#<Pathname:hello>, false,
#<Pathname:/Users/ohalps01/scratch/hello>, #<Pathname:Test/hello>,
true]
It appears that each_entry yields just the basename, without any context.
Regards,
Sean