message.rb class rdoc for fields outdated?

8 views
Skip to first unread message

Schorsch

unread,
Dec 11, 2009, 4:34:48 PM12/11/09
to Ruby's Mail Discussion Group
The message fields which return header[:fields] f.ex. msg.subject,
msg.from, msg.to have a documentation like:

# mail.from.to_s #=> '"M L" <mi...@test.lindsaar.net>'

but it returns the whole header field in the form of:

"To: Andrew Mopsy <m...@salesking.eu>\r\n"

Has this changed between versions and the doc is outdated? I need to
call the value method of a field to get the value ... wich is
perfectly fine

Mikel Lindsaar

unread,
Dec 11, 2009, 8:25:20 PM12/11/09
to mail...@googlegroups.com
Ah, yes, the documentation is outdated.

object#to_s calls the "encoded" method of the object, which is what is inserted into the outputted email, including the field name and the trailing \r\n

If you want to get the value to show to the end user, call object.decoded.

Mikel
--
http://lindsaar.net/
Rails, RSpec and Life blog....


Reply all
Reply to author
Forward
0 new messages