Class: ActiveStorageValidations::ASVAttachableAdapter::Blob

Inherits:
Base
  • Object
show all
Defined in:
lib/active_storage_validations/asv_attachable_adapter.rb

Direct Known Subclasses

SignedId

Instance Method Summary collapse

Methods inherited from Base

#initialize, #rewind

Constructor Details

This class inherits a constructor from ActiveStorageValidations::ASVAttachableAdapter::Base

Instance Method Details

#content_typeObject



105
106
107
# File 'lib/active_storage_validations/asv_attachable_adapter.rb', line 105

def content_type
  @attachable.content_type
end

#filenameObject



109
110
111
# File 'lib/active_storage_validations/asv_attachable_adapter.rb', line 109

def filename
  @attachable.filename
end

#read(max_byte_size: nil) ⇒ Object



113
114
115
# File 'lib/active_storage_validations/asv_attachable_adapter.rb', line 113

def read(max_byte_size: nil)
  max_byte_size ? @attachable.download_chunk(0...max_byte_size) : @attachable.download
end

#with_media_path(tempfile, &block) ⇒ Object



117
118
119
# File 'lib/active_storage_validations/asv_attachable_adapter.rb', line 117

def with_media_path(tempfile, &block)
  copy_to_tempfile(tempfile, @attachable, &block)
end