Skip to content

Commit d0d9339

Browse files
committed
📚 Document fields for Envelope as methods
* Move struct field docs from the class to methods inside the class. * Remove ABNF comments. * Add type information to the call-seq or the method rdoc text. * Link to the data type(s) that are returned, when possible.
1 parent 3773a19 commit d0d9339

File tree

1 file changed

+65
-21
lines changed

1 file changed

+65
-21
lines changed

lib/net/imap/response_data.rb

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -654,27 +654,11 @@ class FetchData < Struct.new(:seqno, :attr)
654654

655655
# Net::IMAP::Envelope represents envelope structures of messages.
656656
#
657-
# ==== Fields:
658-
#
659-
# date:: Returns a string that represents the date.
660-
#
661-
# subject:: Returns a string that represents the subject.
662-
#
663-
# from:: Returns an array of Net::IMAP::Address that represents the from.
664-
#
665-
# sender:: Returns an array of Net::IMAP::Address that represents the sender.
666-
#
667-
# reply_to:: Returns an array of Net::IMAP::Address that represents the reply-to.
668-
#
669-
# to:: Returns an array of Net::IMAP::Address that represents the to.
670-
#
671-
# cc:: Returns an array of Net::IMAP::Address that represents the cc.
672-
#
673-
# bcc:: Returns an array of Net::IMAP::Address that represents the bcc.
674-
#
675-
# in_reply_to:: Returns a string that represents the in-reply-to.
676-
#
677-
# message_id:: Returns a string that represents the message-id.
657+
# [Note]
658+
# When the #sender and #reply_to fields are absent or empty, they will
659+
# return the same value as #from. Also, fields may return values that are
660+
# invalid for well-formed [RFC5322[https://tools.ietf.org/html/rfc5322]]
661+
# messages when the message is malformed or a draft message.
678662
#
679663
# See [{IMAP4rev1 §7.4.2}[https://www.rfc-editor.org/rfc/rfc3501.html#section-7.4.2]]
680664
# and [{IMAP4rev2 §7.5.2}[https://www.rfc-editor.org/rfc/rfc9051.html#section-7.5.2]]
@@ -683,6 +667,66 @@ class FetchData < Struct.new(:seqno, :attr)
683667
#
684668
class Envelope < Struct.new(:date, :subject, :from, :sender, :reply_to,
685669
:to, :cc, :bcc, :in_reply_to, :message_id)
670+
##
671+
# method: date
672+
# call-seq: date -> string
673+
#
674+
# Returns a string that represents the +Date+ header.
675+
676+
##
677+
# method: subject
678+
# call-seq: subject -> string or nil
679+
#
680+
# Returns a string that represents the +Subject+ header, if it is present.
681+
682+
##
683+
# method: from
684+
# call-seq: from -> array of Net::IMAP::Address or nil
685+
#
686+
# Returns an array of Address that represents the +From+ header.
687+
688+
##
689+
# method: sender
690+
# call-seq: sender -> array of Net::IMAP::Address or nil
691+
#
692+
# Returns an array of Address that represents the +Sender+ header.
693+
694+
##
695+
# method: reply_to
696+
# call-seq: reply_to -> array of Net::IMAP::Address or nil
697+
#
698+
# Returns an array of Address that represents the <tt>Reply-To</tt>
699+
# header.
700+
701+
##
702+
# method: to
703+
# call-seq: to -> array of Net::IMAP::Address
704+
#
705+
# Returns an array of Address that represents the +To+ header.
706+
707+
##
708+
# method: cc
709+
# call-seq: cc -> array of Net::IMAP::Address
710+
#
711+
# Returns an array of Address that represents the +Cc+ header.
712+
713+
##
714+
# method: bcc
715+
# call-seq: bcc -> array of Net::IMAP::Address
716+
#
717+
# Returns an array of Address that represents the +Bcc+ header.
718+
719+
##
720+
# method: in_reply_to
721+
# call-seq: in_reply_to -> string
722+
#
723+
# Returns a string that represents the <tt>In-Reply-To</tt> header.
724+
725+
##
726+
# method: message_id
727+
# call-seq: message_id -> string
728+
#
729+
# Returns a string that represents the <tt>Message-ID</tt>.
686730
end
687731

688732
#

0 commit comments

Comments
 (0)