Sha256: 644cdc99e45c12237a6a3a21a13e76692dee86ac5dc8f840a06aea30d4fb59b2

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

require "stashify/file/local"
require "stashify/directory"

module Stashify
  class Directory
    class Local < Stashify::Directory
      def write_directory(directory)
        FileUtils.mkdir(path_of(directory.name))
        super
      end

      def files
        Dir.entries(path).grep_v(/^[.][.]?$/).map do |file_name|
          find(::File.basename(file_name))
        end
      end

      private

      def file?(name)
        ::File.exist?(path_of(name))
      end

      def file(name)
        Stashify::File::Local.new(path: path_of(name))
      end

      def directory?(name)
        ::File.directory?(path_of(name))
      end

      def directory(name)
        Stashify::Directory::Local.new(path: path_of(name))
      end

      def delete_directory(name)
        FileUtils.rm_r(path_of(name))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stashify-3.0.0 lib/stashify/directory/local.rb