lib/saviour/base_uploader.rb in saviour-0.4.4 vs lib/saviour/base_uploader.rb in saviour-0.4.5
- old
+ new
@@ -20,16 +20,23 @@
end
def write(contents, filename)
raise RuntimeError, "Please use `store_dir` before trying to write" unless store_dir
- if Config.processing_enabled
- contents, filename = Uploader::ProcessorsRunner.new(self).run!(contents, filename)
+ catch(:halt_process) do
+ if Config.processing_enabled
+ contents, filename = Uploader::ProcessorsRunner.new(self).run!(contents, filename)
+ end
+
+ path = ::File.join(store_dir, filename)
+ Config.storage.write(contents, path)
+
+ path
end
+ end
- path = ::File.join(store_dir, filename)
- Config.storage.write(contents, path)
- path
+ def halt_process
+ throw(:halt_process)
end
def store_dir
@store_dir ||= Uploader::StoreDirExtractor.new(self).store_dir
end