lib/stashify/directory/local.rb in stashify-2.1.0 vs lib/stashify/directory/local.rb in stashify-2.1.1
- old
+ new
@@ -13,19 +13,10 @@
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
@@ -44,9 +35,17 @@
::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
+
+ def delete_file(name)
+ ::File.delete(path_of(name))
end
end
end
end