class Ftpmock::NetSftpProxy

Constants

Real

Stubbers

Public Class Methods

new(configuration: Ftpmock.configuration) click to toggle source

Instance Methods

# File lib/ftpmock/proxies/net_sftp_proxy.rb, line 37
def initialize(configuration: Ftpmock.configuration)
  @configuration = configuration
end
off!() click to toggle source
# File lib/ftpmock/proxies/net_sftp_proxy.rb, line 28
def self.off!
  return unless Real

  Net.send(:remove_const, :SFTP)
  Net.const_set(:SFTP, Real)
end
on!() { || ... } click to toggle source

inspired by github.com/bblimke/webmock/blob/master/lib/webmock/http_lib_caches/net_http.rb

# File lib/ftpmock/proxies/net_sftp_proxy.rb, line 14
def self.on!
  unless Real
    yield
    return
  end

  Net.send(:remove_const, :SFTP)
  Net.const_set(:SFTP, self)
  if block_given?
    yield
    off!
  end
end

Public Instance Methods

real() click to toggle source

def self.start(*)

i = new
yield i

end

# File lib/ftpmock/proxies/net_sftp_proxy.rb, line 46
def real
  @real ||= Real.new
end