Class: Koine::Filesystem::Adapters::Sftp
- Inherits:
-
Base
- Object
- Base
- Koine::Filesystem::Adapters::Sftp
- Defined in:
- lib/koine/filesystem/adapters/sftp.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Sftp
constructor
A new instance of Sftp.
- #list(path = nil, recursive: false) ⇒ Object
Constructor Details
#initialize(options) ⇒ Sftp
Returns a new instance of Sftp.
20 21 22 23 24 25 26 27 28 |
# File 'lib/koine/filesystem/adapters/sftp.rb', line 20 def initialize() if [:session] @session = .delete(:session) else @hostname = .delete(:hostname) @username = .delete(:username) @options = end end |
Instance Method Details
#list(path = nil, recursive: false) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/koine/filesystem/adapters/sftp.rb', line 30 def list(path = nil, recursive: false) path = format_path(path, '.') matcher = format_matcher(recursive) entries = [] session.dir.glob(path, matcher) do |item| if item.name == '.' || item.name == '..' next end entries << from_result(item, path) end entries end |