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

- old
+ new

@@ -2,26 +2,31 @@ module Backend class FileSystem attr_accessor :root def initialize(root) @root = root - FileUtils.mkdir_p(@root.to_s) + FileUtils.mkdir_p @root.to_s end def copy(form_path, to_filename) - IO.copy_stream(form_path.to_s, @root.join(to_filename.to_s)) + IO.copy_stream form_path.to_s, path(to_filename) end def delete(filename) - ::File.unlink @root.join(filename.to_s) + ::File.unlink path(filename) end def exist?(filename) - ::File.exist? @root.join(filename.to_s) + ::File.exist? path(filename) end + alias exists? exist? def read(filename) - ::File.read @root.join(filename.to_s) + ::File.read path(filename) + end + + def path(filename) + @root.join filename.to_s end end end end