Class: ActionDispatch::Http::UploadedFile
- Inherits:
-
Object
- Object
- ActionDispatch::Http::UploadedFile
- Defined in:
- lib/action_dispatch/http/upload.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#original_filename ⇒ Object
Returns the value of attribute original_filename.
-
#tempfile ⇒ Object
Returns the value of attribute tempfile.
Instance Method Summary collapse
-
#initialize(hash) ⇒ UploadedFile
constructor
A new instance of UploadedFile.
- #read(*args) ⇒ Object
- #rewind ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(hash) ⇒ UploadedFile
Returns a new instance of UploadedFile.
8 9 10 11 12 13 14 |
# File 'lib/action_dispatch/http/upload.rb', line 8 def initialize(hash) @original_filename = hash[:filename] @content_type = hash[:type] @headers = hash[:head] @tempfile = hash[:tempfile] raise(ArgumentError, ':tempfile is required') unless @tempfile end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
6 7 8 |
# File 'lib/action_dispatch/http/upload.rb', line 6 def content_type @content_type end |
#headers ⇒ Object
Returns the value of attribute headers.
6 7 8 |
# File 'lib/action_dispatch/http/upload.rb', line 6 def headers @headers end |
#original_filename ⇒ Object
Returns the value of attribute original_filename.
6 7 8 |
# File 'lib/action_dispatch/http/upload.rb', line 6 def original_filename @original_filename end |
#tempfile ⇒ Object
Returns the value of attribute tempfile.
6 7 8 |
# File 'lib/action_dispatch/http/upload.rb', line 6 def tempfile @tempfile end |
Instance Method Details
#read(*args) ⇒ Object
16 17 18 |
# File 'lib/action_dispatch/http/upload.rb', line 16 def read(*args) @tempfile.read(*args) end |
#rewind ⇒ Object
20 21 22 |
# File 'lib/action_dispatch/http/upload.rb', line 20 def rewind @tempfile.rewind end |
#size ⇒ Object
24 25 26 |
# File 'lib/action_dispatch/http/upload.rb', line 24 def size @tempfile.size end |