Find.find no longer accepts Pathname type as argument
In 2.1, a check for encoding of the paths parameter has been added to File.find. This works perfectly well for String parameters, but this results in a NoMethodError when a Pathname parameter is given. In my opinion a Pathname is a better suitable type to feed to Find.find than a String.
- lib/find.rb (Find.find): Call to_path for arguments to obtain strings. [Bug #10035] Reported by Herwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
#1 [ruby-core:63731] Updated by shevegen (Robert A. Heiler) almost 4 years ago
I don't think I can agree with you in regards to Pathname being a more suitable type - because I rarely use Pathname myself, with just about the single exception being code like this here:
However, if this has been possible in the past then of course it should be preserved for the future as well.
Do you recall in which ruby version it was possible? I would like to test it myself as well (for curiousity reasons mostly).
#2 [ruby-core:63733] Updated by herwinw (Herwin Quarantainenet) almost 4 years ago
It works in ruby-2.0.0-p481.
If you compare the files lib/find.rb from both versions, you can see that some code for encoding has been added. This is where it breaks.
Another option might be to give the Pathname class a method encoding (which could just return self.to_s.encoding). There may be more places where this will break.