lib/stashify/directory/local.rb in stashify-3.2.0 vs lib/stashify/directory/local.rb in stashify-3.2.1
- old
+ new
@@ -3,11 +3,17 @@
require "stashify/file/local"
require "stashify/directory"
module Stashify
class Directory
+ # An implementation for interacting with local directories. The
+ # constructor needs no information on top of what is included
+ # {Stashify::Directory#initialize}, although it's important to
+ # note that setting the files parameter will not do anything.
class Local < Stashify::Directory
+ # Mostly uses the default implementaiton, but needs to create
+ # the directory first so it has a valid destination.
def write_directory(directory)
FileUtils.mkdir(path_of(directory.name))
super
end
@@ -19,10 +25,10 @@
::File.exist?(path_of(name))
end
def files
Dir.entries(path).grep_v(/^[.][.]?$/).map do |file_name|
- find(::File.basename(file_name))
+ find(file_name)
end
end
def file(name)
Stashify::File::Local.new(path: path_of(name))