Class: CarrierWave::Storage::AWSOptions
- Inherits:
-
Object
- Object
- CarrierWave::Storage::AWSOptions
- Defined in:
- lib/carrierwave/storage/aws_options.rb
Constant Summary collapse
- MULTIPART_THRESHOLD =
15 * 1024 * 1024
- MULTIPART_TRESHOLD =
Backward compatibility
MULTIPART_THRESHOLD
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.
13 14 15 |
# File 'lib/carrierwave/storage/aws_options.rb', line 13 def initialize(uploader) @uploader = uploader end |
Instance Attribute Details
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
11 12 13 |
# File 'lib/carrierwave/storage/aws_options.rb', line 11 def uploader @uploader end |
Instance Method Details
#expiration_options(options = {}) ⇒ Object
37 38 39 40 41 |
# File 'lib/carrierwave/storage/aws_options.rb', line 37 def ( = {}) uploader_expiration = uploader.aws_authenticated_url_expiration { expires_in: uploader_expiration }.merge() end |
#move_options(file) ⇒ Object Also known as: copy_options
29 30 31 32 33 34 |
# File 'lib/carrierwave/storage/aws_options.rb', line 29 def (file) { acl: uploader.aws_acl, multipart_copy: file.size >= MULTIPART_THRESHOLD }.merge(aws_attributes).merge() end |
#read_options ⇒ Object
17 18 19 |
# File 'lib/carrierwave/storage/aws_options.rb', line 17 def end |
#write_options(new_file) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/carrierwave/storage/aws_options.rb', line 21 def (new_file) { acl: uploader.aws_acl, body: new_file.to_file, content_type: new_file.content_type }.merge(aws_attributes).merge() end |