Encapsulates a response from the remote server, to a specific client request. Response objects are passed as parameters to callbacks when you are performing asynchronous operations; when you call Net::SFTP::Request#wait, you can get the corresponding response object via Net::SFTP::Request#response.
sftp.open("/path/to/file") do |response| p response.ok? p response[:handle] end sftp.loop
Included modules
Constants
MAP | = | constants.inject({}) do |memo, name| next memo unless name =~ /^FX_(.*)/ memo[const_get(name)] = $1.downcase.tr("_", " ") memo end |
Public Instance Aliases
to_str | -> | to_s |
Attributes
Public Instance methods
[]
(key)
Retrieve the data item with the given key
. The key is
converted to a symbol before being used to lookup the value.
[show source]
# File lib/net/sftp/response.rb, line 41 def [](key) data[key.to_sym] end
eof?
()
Returns true
if the status code is FX_EOF; false
otherwise.
[show source]
# File lib/net/sftp/response.rb, line 63 def eof? code == FX_EOF end
ok?
()
Returns true
if the status code is FX_OK; false
otherwise.
[show source]
# File lib/net/sftp/response.rb, line 58 def ok? code == FX_OK end
to_s
()
Returns a textual description of this response, including the status code and name.
[show source]
# File lib/net/sftp/response.rb, line 47 def to_s if message && !message.empty? && message.downcase != MAP[code] "#{message} (#{MAP[code]}, #{code})" else "#{MAP[code]} (#{code})" end end