Skip to content

Commit dd247db

Browse files
committed
📚 Document fields for namespace structs 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 f807641 commit dd247db

File tree

1 file changed

+41
-25
lines changed

1 file changed

+41
-25
lines changed

lib/net/imap/response_data.rb

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -379,39 +379,55 @@ class MailboxACLItem < Struct.new(:user, :rights, :mailbox)
379379
# The access rights the indicated #user has to the #mailbox.
380380
end
381381

382-
# Net::IMAP::Namespace represents a single [RFC-2342] namespace.
382+
# Net::IMAP::Namespace represents a single namespace contained inside a
383+
# NAMESPACE response.
383384
#
384-
# Namespace = nil / "(" 1*( "(" string SP (<"> QUOTED_CHAR <"> /
385-
# nil) *(Namespace_Response_Extension) ")" ) ")"
386-
#
387-
# Namespace_Response_Extension = SP string SP "(" string *(SP string)
388-
# ")"
389-
#
390-
# ==== Fields:
391-
#
392-
# prefix:: Returns the namespace prefix string.
393-
# delim:: Returns nil or the hierarchy delimiter character.
394-
# extensions:: Returns a hash of extension names to extension flag arrays.
385+
# Returned by Net::IMAP#namespace, contained inside a Namespaces object.
395386
#
396387
class Namespace < Struct.new(:prefix, :delim, :extensions)
388+
##
389+
# method: prefix
390+
# :call-seq: prefix -> string
391+
#
392+
# Returns the namespace prefix string.
393+
394+
##
395+
# method: delim
396+
# :call-seq: delim -> single character string or nil
397+
#
398+
# Returns a hierarchy delimiter character, if it exists.
399+
400+
##
401+
# method: extensions
402+
# :call-seq: extensions -> Hash[String, Array[String]]
403+
#
404+
# A hash of parameters mapped to arrays of strings, for extensibility.
405+
# Extension parameter semantics would be defined by the extension.
397406
end
398407

399-
# Net::IMAP::Namespaces represents the response from [RFC-2342] NAMESPACE.
408+
# Net::IMAP::Namespaces represents a +NAMESPACE+ server response, which
409+
# contains lists of #personal, #shared, and #other namespaces.
400410
#
401-
# Namespace_Response = "*" SP "NAMESPACE" SP Namespace SP Namespace SP
402-
# Namespace
403-
#
404-
# ; The first Namespace is the Personal Namespace(s)
405-
# ; The second Namespace is the Other Users' Namespace(s)
406-
# ; The third Namespace is the Shared Namespace(s)
407-
#
408-
# ==== Fields:
409-
#
410-
# personal:: Returns an array of Personal Net::IMAP::Namespace objects.
411-
# other:: Returns an array of Other Users' Net::IMAP::Namespace objects.
412-
# shared:: Returns an array of Shared Net::IMAP::Namespace objects.
411+
# Net::IMAP#namespace returns a Namespaces object.
413412
#
414413
class Namespaces < Struct.new(:personal, :other, :shared)
414+
##
415+
# method: personal
416+
# :call-seq: personal -> array of Namespace
417+
#
418+
# Returns an array of Personal Namespace objects.
419+
420+
##
421+
# method: other
422+
# :call-seq: other -> array of Namespace
423+
#
424+
# Returns an array of Other Users' Namespace objects.
425+
426+
##
427+
# method: shared
428+
# :call-seq: shared -> array of Namespace
429+
#
430+
# Returns an array of Shared Namespace objects.
415431
end
416432

417433
# Net::IMAP::StatusData represents the contents of the STATUS response.

0 commit comments

Comments
 (0)