Class: Shrine::RackFile
- Inherits:
-
Object
- Object
- Shrine::RackFile
- 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
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#original_filename ⇒ Object
readonly
Returns the value of attribute original_filename.
-
#tempfile ⇒ Object
(also: #to_io)
readonly
Returns the value of attribute tempfile.
Instance Method Summary collapse
-
#initialize(hash) ⇒ RackFile
constructor
A new instance of RackFile.
- #path ⇒ Object
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_type ⇒ Object (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_filename ⇒ Object (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 |
#tempfile ⇒ Object (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
#path ⇒ Object
61 62 63 |
# File 'lib/shrine/plugins/rack_file.rb', line 61 def path @tempfile.path end |