Class: SFTPWriter::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/sftp_writer/factory.rb

Class Method Summary collapse

Class Method Details

.get_writer(config) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/sftp_writer/factory.rb', line 8

def self.get_writer(config)
  if Rails.env.development? || config.host.blank?
    SFTPWriter::Local
  elsif config.key_path.blank?
    raise "SFTP cert not present for #{config.user}@#{config.host}:#{config.port}"
  else
    SFTPWriter::Remote
  end
end