Class: RouteNGN::HTTP::Multipart::FileParam
- Inherits:
-
Object
- Object
- RouteNGN::HTTP::Multipart::FileParam
- Defined in:
- lib/routengn/http/multipart.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.
35 36 37 38 39 |
# File 'lib/routengn/http/multipart.rb', line 35 def initialize( k, filename, content ) @k = k @filename = filename @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
33 34 35 |
# File 'lib/routengn/http/multipart.rb', line 33 def content @content end |
#filename ⇒ Object
Returns the value of attribute filename.
33 34 35 |
# File 'lib/routengn/http/multipart.rb', line 33 def filename @filename end |
#k ⇒ Object
Returns the value of attribute k.
33 34 35 |
# File 'lib/routengn/http/multipart.rb', line 33 def k @k end |
Instance Method Details
#to_multipart ⇒ Object
41 42 43 44 45 |
# File 'lib/routengn/http/multipart.rb', line 41 def to_multipart #return "Content-Disposition: form-data; name=\"#{CGI::escape(k)}\"; filename=\"#{filename}\"\r\n" + "Content-Transfer-Encoding: binary\r\n" + "Content-Type: #{MIME::Types.type_for(@filename)}\r\n\r\n" + content + "\r\n " # Don't escape mine return "Content-Disposition: form-data; name=\"#{k}\"; filename=\"#{filename}\"\r\n" + "Content-Transfer-Encoding: binary\r\n" + "Content-Type: #{MIME::Types.type_for(@filename)}\r\n\r\n" + content + "\r\n" end |