Class: Remi::Extractor::LocalFile

Inherits:
Object
  • Object
show all
Defined in:
lib/remi/extractor/sftp_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(path:, folder: nil) ⇒ LocalFile

Returns a new instance of LocalFile.



5
6
7
8
# File 'lib/remi/extractor/sftp_file.rb', line 5

def initialize(path:, folder: nil)
  @path = path
  @folder = folder
end

Instance Method Details

#extractObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/remi/extractor/sftp_file.rb', line 10

def extract
  if @folder
    Dir.entries(@folder).map do |entry|
      next unless entry.match(@path)
      File.join(@folder,entry)
    end.compact
  else
    @path
  end
end