Class: Merb::Test::MultipartRequestHelper::FileParam
- Inherits:
-
Object
- Object
- Merb::Test::MultipartRequestHelper::FileParam
- Defined in:
- merb-core/lib/merb-core/test/helpers/multipart_request_helper.rb
Instance Attribute Summary (collapse)
-
- (Object) content
Returns the value of attribute content.
-
- (Object) filename
Returns the value of attribute filename.
-
- (Object) key
Returns the value of attribute key.
Instance Method Summary (collapse)
-
- (FileParam) initialize(key, filename, content)
constructor
A new instance of FileParam.
-
- (String) to_multipart
The file parameter in a form suitable for a multipart request.
Constructor Details
- (FileParam) initialize(key, filename, content)
A new instance of FileParam
28 29 30 31 32 |
# File 'merb-core/lib/merb-core/test/helpers/multipart_request_helper.rb', line 28 def initialize(key, filename, content) @key = key @filename = filename @content = content end |
Instance Attribute Details
- (Object) content
Returns the value of attribute content
23 24 25 |
# File 'merb-core/lib/merb-core/test/helpers/multipart_request_helper.rb', line 23 def content @content end |
- (Object) filename
Returns the value of attribute filename
23 24 25 |
# File 'merb-core/lib/merb-core/test/helpers/multipart_request_helper.rb', line 23 def filename @filename end |
- (Object) key
Returns the value of attribute key
23 24 25 |
# File 'merb-core/lib/merb-core/test/helpers/multipart_request_helper.rb', line 23 def key @key end |
Instance Method Details
- (String) to_multipart
The file parameter in a form suitable for a multipart request.
36 37 38 |
# File 'merb-core/lib/merb-core/test/helpers/multipart_request_helper.rb', line 36 def to_multipart return %(Content-Disposition: form-data; name="#{key}"; filename="#{filename}"\r\n) + "Content-Type: #{MIME::Types.type_for(@filename).first}\r\n\r\n" + content + "\r\n" end |