Class: Ckeditor::Http::UploadedFile
- Inherits:
-
Object
- Object
- Ckeditor::Http::UploadedFile
- Defined in:
- lib/ckeditor/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
#initialize(hash) ⇒ UploadedFile
Returns a new instance of UploadedFile.
10 11 12 13 14 15 16 |
# File 'lib/ckeditor/http.rb', line 10 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.
8 9 10 |
# File 'lib/ckeditor/http.rb', line 8 def content_type @content_type end |
#headers ⇒ Object
Returns the value of attribute headers.
8 9 10 |
# File 'lib/ckeditor/http.rb', line 8 def headers @headers end |
#original_filename ⇒ Object
Returns the value of attribute original_filename.
8 9 10 |
# File 'lib/ckeditor/http.rb', line 8 def original_filename @original_filename end |
#tempfile ⇒ Object
Returns the value of attribute tempfile.
8 9 10 |
# File 'lib/ckeditor/http.rb', line 8 def tempfile @tempfile end |
Instance Method Details
#open ⇒ Object
18 19 20 |
# File 'lib/ckeditor/http.rb', line 18 def open @tempfile.open end |
#path ⇒ Object
22 23 24 |
# File 'lib/ckeditor/http.rb', line 22 def path @tempfile.path end |
#read(*args) ⇒ Object
26 27 28 |
# File 'lib/ckeditor/http.rb', line 26 def read(*args) @tempfile.read(*args) end |
#rewind ⇒ Object
30 31 32 |
# File 'lib/ckeditor/http.rb', line 30 def rewind @tempfile.rewind end |
#size ⇒ Object
34 35 36 |
# File 'lib/ckeditor/http.rb', line 34 def size @tempfile.size end |