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.
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_type ⇒ Object (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_filename ⇒ Object (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 |
#tempfile ⇒ Object (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
#path ⇒ Object
97 98 99 |
# File 'lib/shrine/plugins/rack_file.rb', line 97 def path @tempfile.path end |