Skip to content

Commit 031d8a1

Browse files
committed
📚 Document SearchResult/ESearchResult compatibility
1 parent b3f1dfe commit 031d8a1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/net/imap/esearch_result.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ class IMAP
2525
# Some search extensions may result in the server sending ESearchResult
2626
# responses after the initiating command has completed. Use
2727
# IMAP#add_response_handler to handle these responses.
28+
#
29+
# ==== Compatibility with SearchResult
30+
#
31+
# Note that both SearchResult and ESearchResult implement +each+, +to_a+,
32+
# and +to_sequence_set+. These methods can be used regardless of whether
33+
# the server returns +SEARCH+ or +ESEARCH+ data (or no data).
2834
class ESearchResult < Data.define(:tag, :uid, :data)
2935
def initialize(tag: nil, uid: nil, data: nil)
3036
tag => String | nil; tag = -tag if tag

lib/net/imap/search_result.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ class IMAP
77
# identifiers returned by Net::IMAP#uid_search.
88
#
99
# For backward compatibility, SearchResult inherits from Array.
10+
#
11+
# ==== Compatibility with ESearchResult
12+
#
13+
# Note that both SearchResult and ESearchResult implement +each+, +to_a+,
14+
# and +to_sequence_set+. These methods can be used regardless of whether
15+
# the server returns +SEARCH+ or +ESEARCH+ data (or no data).
1016
class SearchResult < Array
1117

1218
# Returns a SearchResult populated with the given +seq_nums+.

0 commit comments

Comments
 (0)