Class: Mortymer::Types::RackFile
- Inherits:
-
Object
- Object
- Mortymer::Types::RackFile
- Defined in:
- lib/mortymer/types.rb
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
readonly
Returns the value of attribute tempfile.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tempfile:, original_filename:, content_type:) ⇒ RackFile
constructor
A new instance of RackFile.
Constructor Details
#initialize(tempfile:, original_filename:, content_type:) ⇒ RackFile
Returns a new instance of RackFile.
12 13 14 15 16 |
# File 'lib/mortymer/types.rb', line 12 def initialize(tempfile:, original_filename:, content_type:) @tempfile = tempfile @original_filename = original_filename @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
10 11 12 |
# File 'lib/mortymer/types.rb', line 10 def content_type @content_type end |
#original_filename ⇒ Object (readonly)
Returns the value of attribute original_filename.
10 11 12 |
# File 'lib/mortymer/types.rb', line 10 def original_filename @original_filename end |
#tempfile ⇒ Object (readonly)
Returns the value of attribute tempfile.
10 11 12 |
# File 'lib/mortymer/types.rb', line 10 def tempfile @tempfile end |
Class Method Details
.new_from_rack_file(file) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/mortymer/types.rb', line 18 def self.new_from_rack_file(file) return nil if file.nil? new( tempfile: file.respond_to?(:tempfile) ? file.tempfile : file[:tempfile], original_filename: file.respond_to?(:original_filename) ? file.original_filename : file[:original_filename], content_type: file.respond_to?(:content_type) ? file.content_type : file[:content_type] ) end |