class Rex::MIME::Part
Attributes
content[RW]
header[RW]
Public Class Methods
new()
click to toggle source
# File lib/rex/mime/part.rb, line 12 def initialize self.header = Rex::MIME::Header.new self.content = '' end
Public Instance Methods
binary_content?()
click to toggle source
Answers if the part content is binary.
@return [Boolean] true if the part content is binary, false otherwise.
# File lib/rex/mime/part.rb, line 32 def binary_content? transfer_encoding && transfer_encoding == 'binary' end
content_encoded()
click to toggle source
Returns the part content with any necessary encoding or transformation applied.
@return [String] Content with encoding or transformations applied.
# File lib/rex/mime/part.rb, line 25 def content_encoded binary_content? ? content : force_crlf(content) end
to_s()
click to toggle source
# File lib/rex/mime/part.rb, line 17 def to_s self.header.to_s + "\r\n" + content_encoded + "\r\n" end
transfer_encoding()
click to toggle source
Returns the Content-Transfer-Encoding of the part.
@return [nil] if the part hasn't Content-Transfer-Encoding. @return [String] The Content-Transfer-Encoding or the part.
# File lib/rex/mime/part.rb, line 40 def transfer_encoding h = header.find('Content-Transfer-Encoding') return nil if h.nil? h[1] end