Sha256: f8cc066541e6ad5395fa070ce676818d4d8ee3485fc0b54331d4751d0948b42c

Contents?: true

Size: 687 Bytes

Versions: 15

Compression:

Stored size: 687 Bytes

Contents

module Scrivito

# @api public
# The FutureBinary class represents the data to be stored in a binary field.
# See {Scrivito::Binary.upload} and {Scrivito::Binary#copy} for details.
class FutureBinary
  attr_reader :filename, :content_type, :id_to_be_copied, :file_to_be_uploaded

  def initialize(filename:, content_type:, id_to_be_copied: nil, file_to_be_uploaded: nil)
    @filename = filename
    @content_type = content_type || content_type_of_filename(filename)
    @id_to_be_copied = id_to_be_copied
    @file_to_be_uploaded = file_to_be_uploaded
  end

  private

  def content_type_of_filename(filename)
    MIME::Types.type_for(filename).first.try(:content_type)
  end
end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
scrivito_sdk-1.1.0.rc1 lib/scrivito/future_binary.rb
scrivito_sdk-1.0.0 lib/scrivito/future_binary.rb
scrivito_sdk-1.0.0.rc4 lib/scrivito/future_binary.rb
scrivito_sdk-1.0.0.rc3 lib/scrivito/future_binary.rb
scrivito_sdk-1.0.0.rc2 lib/scrivito/future_binary.rb
scrivito_sdk-1.0.0.rc1 lib/scrivito/future_binary.rb
scrivito_sdk-0.90.0 lib/scrivito/future_binary.rb
scrivito_sdk-0.90.0.rc3 lib/scrivito/future_binary.rb
scrivito_sdk-0.90.0.rc2 lib/scrivito/future_binary.rb
scrivito_sdk-0.90.0.rc1 lib/scrivito/future_binary.rb
scrivito_sdk-0.71.2 lib/scrivito/future_binary.rb
scrivito_sdk-0.71.1 lib/scrivito/future_binary.rb
scrivito_sdk-0.71.0 lib/scrivito/future_binary.rb
scrivito_sdk-0.71.0.rc2 lib/scrivito/future_binary.rb
scrivito_sdk-0.71.0.rc1 lib/scrivito/future_binary.rb