Module: Shrine::Plugins::Tempfile::FileMethods

Defined in:
lib/shrine/plugins/tempfile.rb

Instance Method Summary collapse

Instance Method Details

#closeObject


29
30
31
32
33
34
# File 'lib/shrine/plugins/tempfile.rb', line 29

def close
  super

  @tempfile.close! if @tempfile
  @tempfile = nil
end

#tempfileObject

Raises:


21
22
23
24
25
26
27
# File 'lib/shrine/plugins/tempfile.rb', line 21

def tempfile
  raise Error, "uploaded file must be opened" unless @io

  @tempfile ||= download
  @tempfile.rewind
  @tempfile
end