diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-02-24 00:54:25 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-02-25 00:41:27 +0300 |
commit | a8c62dfe5c01ed08f170c1d41a39d5167b09631b (patch) | |
tree | 9c25e207356ebc7b2b88f3c0a7cd0e9374f571c8 /app/uploaders/gitlab_uploader.rb | |
parent | 1f8d6c790a8493a341f1786710aac36621e93bf6 (diff) |
Minor refactoring of Uploaders
- Moves a duplicate `file_storage?` definition into the common
`GitlabUploader` ancestor.
- Get the `uploads` base directory from a class method rather than
hard-coding it where it's needed. This will be used in a subsequent MR
to store Uploads in the database.
- Improves the specs for uploaders.
Diffstat (limited to 'app/uploaders/gitlab_uploader.rb')
-rw-r--r-- | app/uploaders/gitlab_uploader.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index 02d7c601d6c..bd7de4ed562 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -1,4 +1,14 @@ class GitlabUploader < CarrierWave::Uploader::Base + def self.base_dir + 'uploads' + end + + delegate :base_dir, to: :class + + def file_storage? + self.class.storage == CarrierWave::Storage::File + end + # Reduce disk IO def move_to_cache true |