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.
- #open ⇒ Object
- #path ⇒ Object
- #read(*args) ⇒ Object
- #rewind ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(hash) ⇒ UploadedFile
Returns a new instance of UploadedFile.
6 7 8 9 10 11 12 |
# File '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 '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 '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 '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 'lib/action_dispatch/http/upload.rb', line 4 def tempfile @tempfile end |
Instance Method Details
#open ⇒ Object
14 15 16 |
# File 'lib/action_dispatch/http/upload.rb', line 14 def open @tempfile.open end |
#path ⇒ Object
18 19 20 |
# File 'lib/action_dispatch/http/upload.rb', line 18 def path @tempfile.path end |
#read(*args) ⇒ Object
22 23 24 |
# File 'lib/action_dispatch/http/upload.rb', line 22 def read(*args) @tempfile.read(*args) end |
#rewind ⇒ Object
26 27 28 |
# File 'lib/action_dispatch/http/upload.rb', line 26 def rewind @tempfile.rewind end |
#size ⇒ Object
30 31 32 |
# File 'lib/action_dispatch/http/upload.rb', line 30 def size @tempfile.size end |