Class: Protocol::Multipart::StringPart

Inherits:
Part
  • Object
show all
Defined in:
lib/protocol/multipart/string_part.rb

Overview

A part that contains string content. Represents a multipart part with string data.

Instance Attribute Summary collapse

Attributes inherited from Part

#headers

Instance Method Summary collapse

Methods inherited from Part

#The headers as name/value pairs.=

Constructor Details

#initialize(headers, content) ⇒ StringPart

Initialize a new StringPart with headers and string content.



17
18
19
20
# File 'lib/protocol/multipart/string_part.rb', line 17

def initialize(headers, content)
  super(headers)
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



23
24
25
# File 'lib/protocol/multipart/string_part.rb', line 23

def content
  @content
end

#The content of the part.(contentofthepart.) ⇒ Object (readonly)



23
# File 'lib/protocol/multipart/string_part.rb', line 23

attr_reader :content

Instance Method Details

#call(writable, boundary) ⇒ Object

Write the part’s content to the provided writable stream.



29
30
31
# File 'lib/protocol/multipart/string_part.rb', line 29

def call(writable, boundary)
  writable.write(@content)
end