Class: Ftpmock::NetSftpProxy
- Inherits:
-
Object
- Object
- Ftpmock::NetSftpProxy
- Defined in:
- lib/ftpmock/proxies/net_sftp_proxy.rb
Constant Summary collapse
- Real =
Stubbers
begin Net::SFTP rescue NameError nil end
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(configuration: Ftpmock.configuration) ⇒ NetSftpProxy
constructor
Instance Methods.
-
#real ⇒ Object
def self.start(*) i = new yield i end.
Constructor Details
#initialize(configuration: Ftpmock.configuration) ⇒ NetSftpProxy
Instance Methods
37 38 39 |
# File 'lib/ftpmock/proxies/net_sftp_proxy.rb', line 37 def initialize(configuration: Ftpmock.configuration) @configuration = configuration end |
Class Method Details
.off! ⇒ Object
28 29 30 31 32 33 |
# 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! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# 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 |