lib/xftp.rb in xftp-0.4.1 vs lib/xftp.rb in xftp-0.4.2
- old
+ new
@@ -13,9 +13,20 @@
# Config accessor
def self.config
@configuration ||= Configuration.new
end
+ # Calls the given block using temporary configuration
+ # :reek:TooManyStatements
+ def self.using(logger: config.logger, ftp: config.ftp, ssh: config.ssh)
+ snapshot = config.clone
+ config.logger = logger
+ config.ftp = ftp
+ config.ssh = ssh
+ yield
+ @configuration = snapshot
+ end
+
# For a block { |config| ... }
# @yield the (see #config)
def self.configure
yield config
end