Class: RedactorRails::Http::UploadedFile
- Inherits:
-
Object
- Object
- RedactorRails::Http::UploadedFile
- Defined in:
- lib/redactor-rails/http.rb
Overview
Create tempfile from hash
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
permalink #initialize(hash) ⇒ UploadedFile
Returns a new instance of UploadedFile.
11 12 13 14 15 16 17 |
# File 'lib/redactor-rails/http.rb', line 11 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
permalink #content_type ⇒ Object
Returns the value of attribute content_type.
9 10 11 |
# File 'lib/redactor-rails/http.rb', line 9 def content_type @content_type end |
permalink #headers ⇒ Object
Returns the value of attribute headers.
9 10 11 |
# File 'lib/redactor-rails/http.rb', line 9 def headers @headers end |
permalink #original_filename ⇒ Object
Returns the value of attribute original_filename.
9 10 11 |
# File 'lib/redactor-rails/http.rb', line 9 def original_filename @original_filename end |
permalink #tempfile ⇒ Object
Returns the value of attribute tempfile.
9 10 11 |
# File 'lib/redactor-rails/http.rb', line 9 def tempfile @tempfile end |
Instance Method Details
permalink #open ⇒ Object
[View source]
19 20 21 |
# File 'lib/redactor-rails/http.rb', line 19 def open @tempfile.open end |
permalink #path ⇒ Object
[View source]
23 24 25 |
# File 'lib/redactor-rails/http.rb', line 23 def path @tempfile.path end |
permalink #read(*args) ⇒ Object
[View source]
27 28 29 |
# File 'lib/redactor-rails/http.rb', line 27 def read(*args) @tempfile.read(*args) end |
permalink #rewind ⇒ Object
[View source]
31 32 33 |
# File 'lib/redactor-rails/http.rb', line 31 def rewind @tempfile.rewind end |
permalink #size ⇒ Object
[View source]
35 36 37 |
# File 'lib/redactor-rails/http.rb', line 35 def size @tempfile.size end |