Sha256: 6feaa1ac50435d58802aa24d413f3b7e54a8d2ff65c99bb4f4d14a6a6f188eca
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
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 write_file(file) ::File.write(path_of(file.name), file.contents) end def delete(name) name_path = ::File.join(path, name) if ::File.directory?(name_path) FileUtils.rm_r(name_path) else ::File.delete(name_path) end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stashify-2.1.0 | lib/stashify/directory/local.rb |
stashify-2.0.0 | lib/stashify/directory/local.rb |