Class: Dolzenko::RemoteDownload::MyStringIO
- Defined in:
- lib/dolzenko/remote_download.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#original_filename ⇒ Object
Returns the value of attribute original_filename.
-
#size ⇒ Object
Returns the value of attribute size.
Class Method Summary collapse
-
.from_http_response(response, request_url) ⇒ Object
Constructs IO object from HTTPResponse.
Instance Method Summary collapse
-
#initialize(*args) ⇒ MyStringIO
constructor
A new instance of MyStringIO.
Constructor Details
#initialize(*args) ⇒ MyStringIO
Returns a new instance of MyStringIO.
78 79 80 |
# File 'lib/dolzenko/remote_download.rb', line 78 def initialize(*args) super(*args) end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
92 93 94 |
# File 'lib/dolzenko/remote_download.rb', line 92 def content_type @content_type end |
#filename ⇒ Object
Returns the value of attribute filename.
92 93 94 |
# File 'lib/dolzenko/remote_download.rb', line 92 def filename @filename end |
#original_filename ⇒ Object
Returns the value of attribute original_filename.
92 93 94 |
# File 'lib/dolzenko/remote_download.rb', line 92 def original_filename @original_filename end |
#size ⇒ Object
Returns the value of attribute size.
92 93 94 |
# File 'lib/dolzenko/remote_download.rb', line 92 def size @size end |
Class Method Details
.from_http_response(response, request_url) ⇒ Object
Constructs IO object from HTTPResponse
83 84 85 86 87 88 89 90 |
# File 'lib/dolzenko/remote_download.rb', line 83 def self.from_http_response(response, request_url) new(response.body).tap do |io| io.size = response.body.size io.content_type = response['content-type'] io.filename = File.basename(request_url) io.original_filename = File.basename(request_url) end end |