Skip to content

Commit b5f38c9

Browse files
committed
📚 Document fields for Address 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 013744b commit b5f38c9

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

lib/net/imap/response_data.rb

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -782,23 +782,48 @@ class Envelope < Struct.new(:date, :subject, :from, :sender, :reply_to,
782782
# +nil+ and empty string as identical.
783783
end
784784

785-
#
786-
# Net::IMAP::Address represents electronic mail addresses.
787-
#
788-
# ==== Fields:
789-
#
790-
# name:: Returns the phrase from [RFC-822] mailbox.
791-
#
792-
# route:: Returns the route from [RFC-822] route-addr.
793-
#
794-
# mailbox:: nil indicates end of [RFC-822] group.
795-
# If non-nil and host is nil, returns [RFC-822] group name.
796-
# Otherwise, returns [RFC-822] local-part.
797-
#
798-
# host:: nil indicates [RFC-822] group syntax.
799-
# Otherwise, returns [RFC-822] domain name.
785+
# Net::IMAP::Address represents an electronic mail address, which has been
786+
# parsed into its component parts by the server. Address objects are
787+
# returned within Envelope fields.
800788
#
801789
class Address < Struct.new(:name, :route, :mailbox, :host)
790+
##
791+
# method: name
792+
# :call-seq: name -> string or nil
793+
#
794+
# Returns the [RFC5322[https://tools.ietf.org/html/rfc5322]] address
795+
# +display-name+ (or the mailbox +phrase+ in the RFC-822 grammar).
796+
797+
##
798+
# method: route
799+
# :call-seq: route -> string or nil
800+
#
801+
# Returns the route from RFC-822 route-addr.
802+
#
803+
# Note:: Generating this obsolete route addressing syntax is not allowed
804+
# by [RFC5322[https://tools.ietf.org/html/rfc5322]]. However,
805+
# addresses with this syntax must still be accepted and parsed.
806+
807+
##
808+
# method: mailbox
809+
# :call-seq: mailbox -> string or nil
810+
#
811+
# Returns the [RFC5322[https://tools.ietf.org/html/rfc5322]] address
812+
# +local-part+, if #host is not +nil+.
813+
#
814+
# When #host is +nil+, this returns
815+
# an [RFC5322[https://tools.ietf.org/html/rfc5322]] group name and a +nil+
816+
# mailbox indicates the end of a group.
817+
818+
##
819+
# method: host
820+
# :call-seq: host -> string or nil
821+
#
822+
# Returns the [RFC5322[https://tools.ietf.org/html/rfc5322]] addr-spec
823+
# +domain+ name.
824+
#
825+
# +nil+ indicates [RFC5322[https://tools.ietf.org/html/rfc5322]] group
826+
# syntax.
802827
end
803828

804829
#

0 commit comments

Comments
 (0)