lib/tori/backend/filesystem.rb in tori-0.0.2 vs lib/tori/backend/filesystem.rb in tori-0.0.3

- old
+ new

@@ -1,18 +1,27 @@ module Tori module Backend class FileSystem + attr_accessor :root def initialize(root) @root = root FileUtils.mkdir_p(@root.to_s) end - def copy(uploader, filename) - IO.copy_stream(uploader, @root.join(filename)) + def copy(form_path, to_filename) + IO.copy_stream(form_path.to_s, @root.join(to_filename.to_s)) end def delete(filename) - File.unlink @root.join(filename) + ::File.unlink @root.join(filename.to_s) + end + + def exist?(filename) + ::File.exist? @root.join(filename.to_s) + end + + def read(filename) + ::File.read @root.join(filename.to_s) end end end end