Sha256: f563294f35c5cb972435c0bb9854d52ebf86d937ae69248c94832eb3d0e9cd7a

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

module Remi
  module Extractor

    class LocalFile < FileSystem
      def initialize(*args, **kargs)
        super
        init_local_file(*args, **kargs)
      end

      # Public: Called to extract files from the source filesystem.
      #
      # Returns an array with containing the paths to all files extracted.
      def extract
        entries.map(&:pathname)
      end

      # Public: Returns an array of all FileSystemEntry instances that are in the remote_path.
      def all_entries
        @all_entries ||= all_entries!
      end

      def all_entries!
        dir = @remote_path.directory? ? @remote_path + '*' : @remote_path
        Dir[dir].map do |entry|
          path = Pathname.new(entry)
          if path.file?
            FileSystemEntry.new(
              pathname: path.realpath.to_s,
              create_time: path.ctime,
              modified_time: path.mtime
            )
          end
        end.compact
      end

      private

      def init_local_file(*args, **kargs)
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
remi-0.2.42 lib/remi/extractor/local_file.rb
remi-0.2.41 lib/remi/extractor/local_file.rb
remi-0.2.40 lib/remi/extractor/local_file.rb
remi-0.2.39 lib/remi/extractor/local_file.rb
remi-0.2.38 lib/remi/extractor/local_file.rb
remi-0.2.37 lib/remi/extractor/local_file.rb
remi-0.2.36 lib/remi/extractor/local_file.rb