Class: Itrp::Multipart::StringParam
- Inherits:
-
Object
- Object
- Itrp::Multipart::StringParam
- Defined in:
- lib/itrp/client/multipart.rb
Overview
Formats a basic string key/value pair for inclusion with a multipart post
Instance Attribute Summary collapse
-
#k ⇒ Object
Returns the value of attribute k.
-
#v ⇒ Object
Returns the value of attribute v.
Instance Method Summary collapse
-
#initialize(k, v) ⇒ StringParam
constructor
A new instance of StringParam.
- #to_multipart ⇒ Object
Constructor Details
#initialize(k, v) ⇒ StringParam
Returns a new instance of StringParam.
47 48 49 50 |
# File 'lib/itrp/client/multipart.rb', line 47 def initialize(k, v) @k = k @v = v end |
Instance Attribute Details
#k ⇒ Object
Returns the value of attribute k.
45 46 47 |
# File 'lib/itrp/client/multipart.rb', line 45 def k @k end |
#v ⇒ Object
Returns the value of attribute v.
45 46 47 |
# File 'lib/itrp/client/multipart.rb', line 45 def v @v end |
Instance Method Details
#to_multipart ⇒ Object
52 53 54 |
# File 'lib/itrp/client/multipart.rb', line 52 def to_multipart return %(Content-Disposition: form-data; name="#{CGI::escape(k.to_s)}"\r\n\r\n#{v}\r\n) end |