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

- old
+ new

@@ -5,11 +5,16 @@ def initialize(root) @root = root FileUtils.mkdir_p @root.to_s end - def copy(form_path, to_filename) - IO.copy_stream form_path.to_s, path(to_filename) + def write(filename, resource) + case resource + when String + ::File.open(path(filename), 'w'){ |f| f.write resource } + else + ::IO.copy_stream resource, path(filename) + end end def delete(filename) ::File.unlink path(filename) end