I have a method to upload a file using the Net::SFTP
gem:
class Uploader
def initialize(host,user,password)
@host = host
@user = user
@password = password
end
def upload(local_file_path,remote_file_path)
Net::SFTP.start(@host,@user,:password => @password) do |sftp|
sftp.upload!(local_file_path,remote_file_path) do |event,uploader,*args|
case event
when :open
Rails.logger("Starting upload...")
when :finished
Rails.logger("Finishing upload...")
end
end
end
end
end
The upload method seems rather large to me. Any suggestions on how I could split it up into smaller components?