lib/xftp/session/sftp.rb in xftp-0.2.0.pre.alpha vs lib/xftp/session/sftp.rb in xftp-0.2.1.pre.alpha

- old
+ new

@@ -17,11 +17,11 @@ # @param [URI] uri the remote uri # @param [Hash] settings the adapter connection settings def initialize(uri, settings = {}) super @path = Pathname '.' - @settings.merge!(password: @credentials[:password]) + @settings[:password] = @credentials[:password] @ssh_options = XFTP.config.ssh.deep_merge(@settings) end # Changes the current (remote) working directory # @param [String] path the relative (remote) path @@ -42,12 +42,19 @@ # in a current working directory on the remote host def exists?(filename) entries.include? filename end - # @return [Boolean] `true` if the argument refers to a directory on the remote host - def directory?(dirname) - @sftp.file.directory? remote_path(dirname) + # @return [Boolean] `true` if the argument refers to + # a directory on the remote host + def directory?(path) + @sftp.file.directory? remote_path(path) + end + + # @return [Boolean] `true` if the argument refers to + # a file on the remote host + def file?(path) + !directory?(path) end # Removes the remote directory # @param [String] dirname the name of directory to be removed def rmdir(dirname)