Class: Rex::MIME::Part
- Inherits:
-
Object
- Object
- Rex::MIME::Part
- Includes:
- Encoding
- Defined in:
- lib/rex/mime/part.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#header ⇒ Object
Returns the value of attribute header.
Instance Method Summary collapse
-
#binary_content? ⇒ Boolean
Answers if the part content is binary.
-
#content_encoded ⇒ String
Returns the part content with any necessary encoding or transformation applied.
-
#initialize ⇒ Part
constructor
A new instance of Part.
- #to_s ⇒ Object
-
#transfer_encoding ⇒ nil, String
Returns the Content-Transfer-Encoding of the part.
Methods included from Encoding
Constructor Details
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
11 12 13 |
# File 'lib/rex/mime/part.rb', line 11 def content @content end |
#header ⇒ Object
Returns the value of attribute header.
11 12 13 |
# File 'lib/rex/mime/part.rb', line 11 def header @header end |
Instance Method Details
#binary_content? ⇒ Boolean
Answers if the part content is binary.
33 34 35 |
# File 'lib/rex/mime/part.rb', line 33 def binary_content? transfer_encoding && transfer_encoding == 'binary' end |
#content_encoded ⇒ String
Returns the part content with any necessary encoding or transformation applied.
26 27 28 |
# File 'lib/rex/mime/part.rb', line 26 def content_encoded binary_content? ? content : force_crlf(content) end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/rex/mime/part.rb', line 18 def to_s self.header.to_s + "\r\n" + content_encoded + "\r\n" end |
#transfer_encoding ⇒ nil, String
Returns the Content-Transfer-Encoding of the part.
41 42 43 44 45 46 |
# File 'lib/rex/mime/part.rb', line 41 def transfer_encoding h = header.find('Content-Transfer-Encoding') return nil if h.nil? h[1] end |