Add storage managers (local, sftp, s3, hybrid).
This commit is contained in:
23
app/logical/storage_manager/hybrid.rb
Normal file
23
app/logical/storage_manager/hybrid.rb
Normal 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
|
||||
Reference in New Issue
Block a user