Class: Shrine::RackFile

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/shrine/plugins/rack_file.rb

Overview

This is used to wrap the Rack hash into an IO-like object which Shrine can upload.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ RackFile

Returns a new instance of RackFile.



55
56
57
58
59
# File 'lib/shrine/plugins/rack_file.rb', line 55

def initialize(hash)
  @tempfile          = hash[:tempfile]
  @original_filename = hash[:filename]
  @content_type      = hash[:type]
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



52
53
54
# File 'lib/shrine/plugins/rack_file.rb', line 52

def content_type
  @content_type
end

#original_filenameObject (readonly)

Returns the value of attribute original_filename.



52
53
54
# File 'lib/shrine/plugins/rack_file.rb', line 52

def original_filename
  @original_filename
end

#tempfileObject (readonly) Also known as: to_io

Returns the value of attribute tempfile.



52
53
54
# File 'lib/shrine/plugins/rack_file.rb', line 52

def tempfile
  @tempfile
end

Instance Method Details

#pathObject



61
62
63
# File 'lib/shrine/plugins/rack_file.rb', line 61

def path
  @tempfile.path
end