Class: ActionDispatch::Http::UploadedFile
- Defined in:
- actionpack/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
Constructor Details
#initialize(hash) ⇒ UploadedFile
Returns a new instance of UploadedFile.
6 7 8 9 10 11 12 |
# File 'actionpack/lib/action_dispatch/http/upload.rb', line 6 def initialize(hash) @original_filename = encode_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
4 5 6 |
# File 'actionpack/lib/action_dispatch/http/upload.rb', line 4 def content_type @content_type end |
#headers ⇒ Object
Returns the value of attribute headers
4 5 6 |
# File 'actionpack/lib/action_dispatch/http/upload.rb', line 4 def headers @headers end |
#original_filename ⇒ Object
Returns the value of attribute original_filename
4 5 6 |
# File 'actionpack/lib/action_dispatch/http/upload.rb', line 4 def original_filename @original_filename end |
#tempfile ⇒ Object
Returns the value of attribute tempfile
4 5 6 |
# File 'actionpack/lib/action_dispatch/http/upload.rb', line 4 def tempfile @tempfile end |
Instance Method Details
#read(*args) ⇒ Object
14 15 16 |
# File 'actionpack/lib/action_dispatch/http/upload.rb', line 14 def read(*args) @tempfile.read(*args) end |