class CarrierWave::Storage::AWSOptions

Constants

MULTIPART_TRESHOLD

Attributes

uploader[R]

Public Class Methods

new(uploader) click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 10
def initialize(uploader)
  @uploader = uploader
end

Public Instance Methods

copy_options(file)
Alias for: move_options
expiration_options(options = {}) click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 34
def expiration_options(options = {})
  uploader_expiration = uploader.aws_authenticated_url_expiration

  { expires_in: uploader_expiration }.merge(options)
end
move_options(file) click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 26
def move_options(file)
  {
    acl: uploader.aws_acl,
    multipart_copy: file.size >= MULTIPART_TRESHOLD
  }.merge(aws_attributes).merge(aws_write_options)
end
Also aliased as: copy_options
read_options() click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 14
def read_options
  aws_read_options
end
write_options(new_file) click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 18
def write_options(new_file)
  {
    acl: uploader.aws_acl,
    body: new_file.to_file,
    content_type: new_file.content_type
  }.merge(aws_attributes).merge(aws_write_options)
end

Private Instance Methods

aws_attributes() click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 42
def aws_attributes
  attributes = uploader.aws_attributes
  return {} if attributes.nil?
  attributes.respond_to?(:call) ? attributes.call : attributes
end
aws_read_options() click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 48
def aws_read_options
  uploader.aws_read_options || {}
end
aws_write_options() click to toggle source
# File lib/carrierwave/storage/aws_options.rb, line 52
def aws_write_options
  uploader.aws_write_options || {}
end