Class: Paperclip::TempfileFactory
- Inherits:
-
Object
- Object
- Paperclip::TempfileFactory
- Defined in:
- lib/paperclip/tempfile_factory.rb
Instance Method Summary collapse
Instance Method Details
#basename ⇒ Object
14 15 16 |
# File 'lib/paperclip/tempfile_factory.rb', line 14 def basename Digest::MD5.hexdigest(File.basename(@name, extension)) end |
#extension ⇒ Object
10 11 12 |
# File 'lib/paperclip/tempfile_factory.rb', line 10 def extension File.extname(@name) end |
#generate(name = random_name) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/paperclip/tempfile_factory.rb', line 3 def generate(name = random_name) @name = name file = Tempfile.new([basename, extension]) file.binmode file end |
#random_name ⇒ Object
18 19 20 |
# File 'lib/paperclip/tempfile_factory.rb', line 18 def random_name SecureRandom.uuid end |