Add storage managers (local, sftp, s3, hybrid).

This commit is contained in:
evazion
2018-03-14 16:57:29 -05:00
parent 8a012d4c91
commit b0c7d9c185
8 changed files with 332 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
class StorageManager::Hybrid < StorageManager
attr_reader :submanager
def initialize(&block)
@submanager = block
end
def store_file(io, post, type)
submanager[post.id, post.md5, post.file_ext, type].store_file(io, post, type)
end
def delete_file(post_id, md5, file_ext, type)
submanager[post_id, md5, file_ext, type].delete_file(post_id, md5, file_ext, type)
end
def open_file(io, post, type)
submanager[post.id, post.md5, post.file_ext, type].open_file(post, type)
end
def file_url(post, type)
submanager[post.id, post.md5, post.file_ext, type].file_url(post, type)
end
end