Class: Multipart::FileParam
- Inherits:
-
Object
- Object
- Multipart::FileParam
- Defined in:
- lib/spout/helpers/send_file.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#k ⇒ Object
Returns the value of attribute k.
Instance Method Summary collapse
-
#initialize(k, filename, content) ⇒ FileParam
constructor
A new instance of FileParam.
- #to_multipart ⇒ Object
Constructor Details
#initialize(k, filename, content) ⇒ FileParam
Returns a new instance of FileParam.
73 74 75 76 77 |
# File 'lib/spout/helpers/send_file.rb', line 73 def initialize(k, filename, content) @k = k @filename = filename @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
72 73 74 |
# File 'lib/spout/helpers/send_file.rb', line 72 def content @content end |
#filename ⇒ Object
Returns the value of attribute filename.
72 73 74 |
# File 'lib/spout/helpers/send_file.rb', line 72 def filename @filename end |
#k ⇒ Object
Returns the value of attribute k.
72 73 74 |
# File 'lib/spout/helpers/send_file.rb', line 72 def k @k end |
Instance Method Details
#to_multipart ⇒ Object
79 80 81 82 |
# File 'lib/spout/helpers/send_file.rb', line 79 def to_multipart mime_type = "application/octet-stream" "Content-Disposition: form-data; name=\"#{k}\"; filename=\"#{filename}\"\r\n" + "Content-Transfer-Encoding: binary\r\n" + "Content-Type: #{mime_type}\r\n\r\n" + content + "\r\n" end |