io = sftp.file.open claims to produce an IO-like object. However, trying to use it as output for CSV gives an error.
Here is an example
require 'net/sftp'
require 'csv'
Net::SFTP.start(
'localhost',
'foo',
password: 'pass',
) do |sftp|
ftp_upload_path = 'upload/test_file.csv'
sftp.file.open(ftp_upload_path, "w+") do |file|
csv = CSV.new(file)
csv << ["row", "of", "CSV", "data"]
end
end
This generate the following error
NoMethodError: undefined method `<<' for #<Net::SFTP::Operations::File:0x007f830419c718>
from /Users/cdan/.rbenv/versions/2.3.0/lib/ruby/2.3.0/csv.rb:1692:in `<<'
The easy fix would be to probably implement Net::SFTP::Operations::File#<< in terms of Net::SFTP::Operations::File#write
io = sftp.file.open
claims to produce an IO-like object. However, trying to use it as output for CSV gives an error. Here is an exampleThis generate the following error
The easy fix would be to probably implement
Net::SFTP::Operations::File#<<
in terms ofNet::SFTP::Operations::File#write
This is similar.related to #65 .