Class | RMail::Serialize |
In: |
lib/rmail/serialize.rb
|
Parent: | Object |
The RMail::Serialize class writes an RMail::Message object into an IO object or string. The result is a standard mail message in text form.
To do this, you pass the RMail::Message object to the RMail::Serialize object. RMail::Serialize can write into any object supporting the << method.
As a convenience, RMail::Serialize.write is a class method you can use directly:
# Write to a file File.open('my-message', 'w') { |f| RMail::Serialize.write(f, message) }
# Write to a new string string = RMail::Serialize.write(’’, message)
Initialize this Serialize object with an output stream. If escape_from is not nil, lines with a leading From are escaped.
Serialize a message into a given output object. The output object must support the << method in the same way that an IO or String object does.