Net::FTP support pathnames #828
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pathname support was added to Net::FTP list and getbinaryfile methods by @shugo in 613a324.
This pull request fixes the following error when calling String#+ with a Pathname:
TypeError: no implicit conversion of Pathname into String
Found in the following Net::FTP instance methods:
chdir
delete
gettextfile
mdtm
mkdir
nlst
putbinaryfile
puttextfile
rename
rmdir
size
Note, this pull request normalizes the changes from 613a324 so each of these methods support Pathnames in the same way, via String interpolation (see the second commit). It's my opinion this is more readable and seems to creates less String objects.
The third commit adds commented tests that I used to recreate the TypeError but don't actually test the methods correctly. I can either do correct tests with someone's help (nlst with returning filelists was not easy to test), remove the commented tests, or leave them commented.
I wasn't sure if I should add a ChangeLog entry or if someone on ruby-core is supposed to do that.
Please advise.
Thanks in advance for your review!
cc @tenderlove