Commit 50b68fc2 authored by Shinya Maeda's avatar Shinya Maeda

Use prepend to correctly use the monketpatch's method

parent b358d263
......@@ -5,6 +5,7 @@ module CarrierWave
module Storage
class Fog < Abstract
class File
module MonkeyPatch
def read
file_body = file.body
......@@ -24,18 +25,21 @@ module CarrierWave
new_file.copy_to(path)
else
fog_file = new_file.to_file
@content_type ||= new_file.content_type
@file = directory.files.create({
@content_type ||= new_file.content_type # rubocop:disable Gitlab/ModuleWithInstanceVariables
@file = directory.files.create({ # rubocop:disable Gitlab/ModuleWithInstanceVariables
:body => fog_file ? fog_file : new_file.read, # rubocop:disable Gitlab/HashSyntax
:content_type => @content_type, # rubocop:disable Gitlab/HashSyntax
:content_type => @content_type, # rubocop:disable Gitlab/HashSyntax,Gitlab/ModuleWithInstanceVariables
:key => path, # rubocop:disable Gitlab/HashSyntax
:public => @uploader.fog_public # rubocop:disable Gitlab/HashSyntax
}.merge(@uploader.fog_attributes))
:public => @uploader.fog_public # rubocop:disable Gitlab/HashSyntax,Gitlab/ModuleWithInstanceVariables
}.merge(@uploader.fog_attributes)) # rubocop:disable Gitlab/ModuleWithInstanceVariables
fog_file.close if fog_file && !fog_file.closed?
end
true
end
end
prepend MonkeyPatch
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment