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.



91
92
93
94
95
# File 'lib/shrine/plugins/rack_file.rb', line 91

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.



88
89
90
# File 'lib/shrine/plugins/rack_file.rb', line 88

def content_type
  @content_type
end

#original_filenameObject (readonly)

Returns the value of attribute original_filename.



88
89
90
# File 'lib/shrine/plugins/rack_file.rb', line 88

def original_filename
  @original_filename
end

#tempfileObject (readonly) Also known as: to_io

Returns the value of attribute tempfile.



88
89
90
# File 'lib/shrine/plugins/rack_file.rb', line 88

def tempfile
  @tempfile
end

Instance Method Details

#pathObject



97
98
99
# File 'lib/shrine/plugins/rack_file.rb', line 97

def path
  @tempfile.path
end