Class: JschSFTP::SFTP::Channel
- Inherits:
-
Object
- Object
- JschSFTP::SFTP::Channel
- Defined in:
- lib/jsch_sftp/sftp/channel.rb
Class Method Summary collapse
Instance Method Summary collapse
- #connected? ⇒ Boolean
- #disconnect ⇒ Object
- #download!(remote_filepath, local_filepath) ⇒ Object
- #entries(remote_path) ⇒ Object
-
#initialize(channel) ⇒ Channel
constructor
A new instance of Channel.
- #mkdir(remote_path) ⇒ Object
- #upload!(local_filepath, remote_filepath) ⇒ Object
Constructor Details
#initialize(channel) ⇒ Channel
Returns a new instance of Channel.
7 8 9 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 7 def initialize(channel) @channel = channel end |
Class Method Details
.connect(session) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 37 def self.connect(session) channel = session.open_channel("sftp") channel.connect self.new(channel) end |
Instance Method Details
#connected? ⇒ Boolean
11 12 13 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 11 def connected? channel.is_connected end |
#disconnect ⇒ Object
31 32 33 34 35 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 31 def disconnect if connected? channel.disconnect rescue nil end end |
#download!(remote_filepath, local_filepath) ⇒ Object
15 16 17 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 15 def download!(remote_filepath, local_filepath) channel.get(remote_filepath, local_filepath) end |
#entries(remote_path) ⇒ Object
27 28 29 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 27 def entries(remote_path) to_entries(channel.ls(remote_path)) end |
#mkdir(remote_path) ⇒ Object
23 24 25 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 23 def mkdir(remote_path) channel.mkdir(remote_path) end |
#upload!(local_filepath, remote_filepath) ⇒ Object
19 20 21 |
# File 'lib/jsch_sftp/sftp/channel.rb', line 19 def upload!(local_filepath, remote_filepath) channel.put(local_filepath, remote_filepath) end |