Class: Pludoni::Pdfutils::ActiveStorageWrapper

Inherits:
FileWrapper
  • Object
show all
Defined in:
lib/pludoni/pdfutils/active_storage_wrapper.rb

Instance Method Summary collapse

Methods inherited from FileWrapper

#initialize, make

Constructor Details

This class inherits a constructor from Pludoni::Pdfutils::FileWrapper

Instance Method Details

#content_typeObject



22
23
24
# File 'lib/pludoni/pdfutils/active_storage_wrapper.rb', line 22

def content_type
  @file.content_type
end

#filenameObject



14
15
16
# File 'lib/pludoni/pdfutils/active_storage_wrapper.rb', line 14

def filename
  @file.filename.to_s
end

#filesizeObject



4
5
6
# File 'lib/pludoni/pdfutils/active_storage_wrapper.rb', line 4

def filesize
  @file.byte_size
end

#open(&block) ⇒ Object



18
19
20
# File 'lib/pludoni/pdfutils/active_storage_wrapper.rb', line 18

def open(&block)
  @file.open(&block)
end

#to_tfObject



8
9
10
11
12
# File 'lib/pludoni/pdfutils/active_storage_wrapper.rb', line 8

def to_tf
  file = Tempfile.new([@file.filename.base, @file.filename.extension_with_delimiter])
  ActiveStorage::Downloader.new(@file.service).send(:download, @file.key, file)
  file
end