From: Run Paint Run Run Date: 2009-09-04T02:35:16+09:00 Subject: [ruby-core:25326] [Bug #2037] [PATCH] Alias Dir#path to Dir#to_path Bug #2037: [PATCH] Alias Dir#path to Dir#to_path http://redmine.ruby-lang.org/issues/show/2037 Author: Run Paint Run Run Status: Open, Priority: Normal Category: core ruby -v: ruby 1.9.2dev (2009-09-03 trunk 24741) [i686-linu 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 ---------------------------------------- http://redmine.ruby-lang.org