Project

General

Profile

Actions

Bug #2037

closed

[PATCH] Alias Dir#path to Dir#to_path

Added by runpaint (Run Paint Run Run) over 14 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-09-03 trunk 24741) [i686-linu
Backport:
[ruby-core:25326]

Description

=begin
The Dir class does not have a #to_path method. This means that although it calls #to_path on arguments it expects to be directories, its instances cannot be used as such arguments. The File class has #to_path as an alias for #path.

The attached trivial patch simply adds an alias for Dir#path named Dir#to_path.

Before:

Dir.entries(Dir.new('/tmp')).size
TypeError: can't convert Dir into String
from (irb):2:in open' from (irb):2:in entries'
from (irb):2
from /usr/local/bin/irb:12:in `'

After:

Dir.entries(Dir.new('/tmp')).size
=> 245
=end


Files

dir-to-path.patch (665 Bytes) dir-to-path.patch runpaint (Run Paint Run Run), 09/04/2009 02:35 AM
Actions #1

Updated by matz (Yukihiro Matsumoto) over 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r24744.
=end

Actions

Also available in: Atom PDF

Like0
Like0