Class: Param

Inherits:
Object
  • Object
show all
Defined in:
lib/mime_parts.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value, content_type) ⇒ Param

Returns a new instance of Param.



5
6
7
# File 'lib/mime_parts.rb', line 5

def initialize(key, value, content_type)
  @key = key; @value = value; @content_type = content_type
end

Instance Attribute Details

#content_typeObject

Returns the value of attribute content_type.



4
5
6
# File 'lib/mime_parts.rb', line 4

def content_type
  @content_type
end

#keyObject

Returns the value of attribute key.



4
5
6
# File 'lib/mime_parts.rb', line 4

def key
  @key
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/mime_parts.rb', line 4

def value
  @value
end

Instance Method Details

#to_multipartObject



9
10
11
12
13
# File 'lib/mime_parts.rb', line 9

def to_multipart
  return "\r\nContent-Disposition: form-data; name=\"#{CGI::escape(key)}\"\r\n" +
"Content-Type: #{content_type}; charset=UTF-8" +
"\r\n\r\n#{value}\r\n"
end