Class: CarrierWave::Storage::AWSOptions
- Inherits:
-
Object
- Object
- CarrierWave::Storage::AWSOptions
- Defined in:
- lib/carrierwave/storage/aws_options.rb
Constant Summary collapse
- MULTIPART_TRESHOLD =
15 * 1024 * 1024
Instance Attribute Summary collapse
-
#uploader ⇒ Object
readonly
Returns the value of attribute uploader.
Instance Method Summary collapse
- #expiration_options(options = {}) ⇒ Object
-
#initialize(uploader) ⇒ AWSOptions
constructor
A new instance of AWSOptions.
- #move_options(file) ⇒ Object (also: #copy_options)
- #read_options ⇒ Object
- #write_options(new_file) ⇒ Object
Constructor Details
#initialize(uploader) ⇒ AWSOptions
Returns a new instance of AWSOptions.
10 11 12 |
# File 'lib/carrierwave/storage/aws_options.rb', line 10 def initialize(uploader) @uploader = uploader end |
Instance Attribute Details
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
8 9 10 |
# File 'lib/carrierwave/storage/aws_options.rb', line 8 def uploader @uploader end |
Instance Method Details
#expiration_options(options = {}) ⇒ Object
34 35 36 37 38 |
# File 'lib/carrierwave/storage/aws_options.rb', line 34 def ( = {}) uploader_expiration = uploader.aws_authenticated_url_expiration { expires_in: uploader_expiration }.merge() end |
#move_options(file) ⇒ Object Also known as: copy_options
26 27 28 29 30 31 |
# File 'lib/carrierwave/storage/aws_options.rb', line 26 def (file) { acl: uploader.aws_acl, multipart_copy: file.size >= MULTIPART_TRESHOLD }.merge(aws_attributes).merge() end |
#read_options ⇒ Object
14 15 16 |
# File 'lib/carrierwave/storage/aws_options.rb', line 14 def end |
#write_options(new_file) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/carrierwave/storage/aws_options.rb', line 18 def (new_file) { acl: uploader.aws_acl, body: new_file.to_file, content_type: new_file.content_type }.merge(aws_attributes).merge() end |