net-imap 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/net/imap/config/attr_type_coercion.rb +5 -1
- data/lib/net/imap/sequence_set.rb +179 -37
- data/lib/net/imap.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6d2d79f907ce00d056ead396fafe73bbdf84fc54b01e1f2536d6490c001c723
|
4
|
+
data.tar.gz: 6fba3cd04144fedd7b178959451631ea14cff8f248ca963961b3945b636cec4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80f15f967d4260638d423b802204360e25704cc47c59d110a85f401c1554882521097d5014ecc3e7a0a17f87e8995ae87f553d73a26f3c8abc84744ad5d236ed
|
7
|
+
data.tar.gz: 2790cbc5ee60b3da3648e8bd91df90ecac7c72e0febca11464400460fd5c34db3123d307f39901ea7c313942f2feb11bb3c0f7dbc06b96094b6d1738426b278a
|
@@ -28,7 +28,11 @@ module Net
|
|
28
28
|
end
|
29
29
|
private_class_method :included
|
30
30
|
|
31
|
-
|
31
|
+
if defined?(Ractor.make_shareable)
|
32
|
+
def self.safe(...) Ractor.make_shareable nil.instance_eval(...).freeze end
|
33
|
+
else
|
34
|
+
def self.safe(...) nil.instance_eval(...).freeze end
|
35
|
+
end
|
32
36
|
private_class_method :safe
|
33
37
|
|
34
38
|
Types = Hash.new do |h, type| type => Proc | nil; safe{type} end
|
@@ -108,11 +108,15 @@ module Net
|
|
108
108
|
# When a set includes <tt>*</tt>, some methods may have surprising behavior.
|
109
109
|
#
|
110
110
|
# For example, #complement treats <tt>*</tt> as its own number. This way,
|
111
|
-
# the #intersection of a set and its #complement will always be empty.
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
111
|
+
# the #intersection of a set and its #complement will always be empty. And
|
112
|
+
# <tt>*</tt> is sorted as greater than any other number in the set. This is
|
113
|
+
# not how an \IMAP server interprets the set: it will convert <tt>*</tt> to
|
114
|
+
# the number of messages in the mailbox, the +UID+ of the last message in
|
115
|
+
# the mailbox, or +UIDNEXT+, as appropriate. Several methods have an
|
116
|
+
# argument for how <tt>*</tt> should be interpreted.
|
117
|
+
#
|
118
|
+
# But, for example, this means that there may be overlap between a set and
|
119
|
+
# its complement after #limit is applied to each:
|
116
120
|
#
|
117
121
|
# ~Net::IMAP::SequenceSet["*"] == Net::IMAP::SequenceSet[1..(2**32-1)]
|
118
122
|
# ~Net::IMAP::SequenceSet[1..5] == Net::IMAP::SequenceSet["6:*"]
|
@@ -179,9 +183,9 @@ module Net
|
|
179
183
|
# - #include_star?: Returns whether the set contains <tt>*</tt>.
|
180
184
|
#
|
181
185
|
# <i>Minimum and maximum value elements:</i>
|
182
|
-
# - #min: Returns the
|
183
|
-
# - #max: Returns the
|
184
|
-
# - #minmax: Returns the
|
186
|
+
# - #min: Returns one or more of the lowest numbers in the set.
|
187
|
+
# - #max: Returns one or more of the highest numbers in the set.
|
188
|
+
# - #minmax: Returns the lowest and highest numbers in the set.
|
185
189
|
#
|
186
190
|
# <i>Accessing value by offset in sorted set:</i>
|
187
191
|
# - #[] (aliased as #slice): Returns the number or consecutive subset at a
|
@@ -248,6 +252,10 @@ module Net
|
|
248
252
|
# +self+ and the other set except those common to both.
|
249
253
|
# - #~ (aliased as #complement): Returns a new set containing all members
|
250
254
|
# that are not in +self+
|
255
|
+
# - #above: Return a copy of +self+ which only contains numbers above a
|
256
|
+
# given number.
|
257
|
+
# - #below: Return a copy of +self+ which only contains numbers below a
|
258
|
+
# given value.
|
251
259
|
# - #limit: Returns a copy of +self+ which has replaced <tt>*</tt> with a
|
252
260
|
# given maximum value and removed all members over that maximum.
|
253
261
|
#
|
@@ -567,26 +575,52 @@ module Net
|
|
567
575
|
empty? || input_to_tuples(other).none? { intersect_tuple? _1 }
|
568
576
|
end
|
569
577
|
|
570
|
-
# :call-seq:
|
578
|
+
# :call-seq:
|
579
|
+
# max(star: :*) => integer or star or nil
|
580
|
+
# max(count, star: :*) => SequenceSet
|
571
581
|
#
|
572
582
|
# Returns the maximum value in +self+, +star+ when the set includes
|
573
583
|
# <tt>*</tt>, or +nil+ when the set is empty.
|
574
|
-
|
575
|
-
|
584
|
+
#
|
585
|
+
# When +count+ is given, a new SequenceSet is returned, containing only
|
586
|
+
# the last +count+ numbers. An empty SequenceSet is returned when +self+
|
587
|
+
# is empty. (+star+ is ignored when +count+ is given.)
|
588
|
+
#
|
589
|
+
# Related: #min, #minmax, #slice
|
590
|
+
def max(count = nil, star: :*)
|
591
|
+
if count
|
592
|
+
slice(-[count, size].min..) || remain_frozen_empty
|
593
|
+
elsif (val = @tuples.last&.last)
|
594
|
+
val == STAR_INT ? star : val
|
595
|
+
end
|
576
596
|
end
|
577
597
|
|
578
|
-
# :call-seq:
|
598
|
+
# :call-seq:
|
599
|
+
# min(star: :*) => integer or star or nil
|
600
|
+
# min(count, star: :*) => SequenceSet
|
579
601
|
#
|
580
602
|
# Returns the minimum value in +self+, +star+ when the only value in the
|
581
603
|
# set is <tt>*</tt>, or +nil+ when the set is empty.
|
582
|
-
|
583
|
-
|
604
|
+
#
|
605
|
+
# When +count+ is given, a new SequenceSet is returned, containing only
|
606
|
+
# the first +count+ numbers. An empty SequenceSet is returned when +self+
|
607
|
+
# is empty. (+star+ is ignored when +count+ is given.)
|
608
|
+
#
|
609
|
+
# Related: #max, #minmax, #slice
|
610
|
+
def min(count = nil, star: :*)
|
611
|
+
if count
|
612
|
+
slice(0...count) || remain_frozen_empty
|
613
|
+
elsif (val = @tuples.first&.first)
|
614
|
+
val != STAR_INT ? val : star
|
615
|
+
end
|
584
616
|
end
|
585
617
|
|
586
618
|
# :call-seq: minmax(star: :*) => nil or [integer, integer or star]
|
587
619
|
#
|
588
620
|
# Returns a 2-element array containing the minimum and maximum numbers in
|
589
621
|
# +self+, or +nil+ when the set is empty.
|
622
|
+
#
|
623
|
+
# Related: #min, #max
|
590
624
|
def minmax(star: :*); [min(star: star), max(star: star)] unless empty? end
|
591
625
|
|
592
626
|
# Returns false when the set is empty.
|
@@ -613,7 +647,14 @@ module Net
|
|
613
647
|
# Net::IMAP::SequenceSet["1:5"] | 2 | [4..6, 99]
|
614
648
|
# #=> Net::IMAP::SequenceSet["1:6,99"]
|
615
649
|
#
|
616
|
-
# Related: #add, #merge
|
650
|
+
# Related: #add, #merge, #&, #-, #^, #~
|
651
|
+
#
|
652
|
+
# ==== Set identities
|
653
|
+
#
|
654
|
+
# <tt>lhs | rhs</tt> is equivalent to:
|
655
|
+
# * <tt>rhs | lhs</tt> (commutative)
|
656
|
+
# * <tt>~(~lhs & ~rhs)</tt> (De Morgan's Law)
|
657
|
+
# * <tt>(lhs & rhs) ^ (lhs ^ rhs)</tt>
|
617
658
|
def |(other) remain_frozen dup.merge other end
|
618
659
|
alias :+ :|
|
619
660
|
alias union :|
|
@@ -632,7 +673,17 @@ module Net
|
|
632
673
|
# Net::IMAP::SequenceSet[1..5] - 2 - 4 - 6
|
633
674
|
# #=> Net::IMAP::SequenceSet["1,3,5"]
|
634
675
|
#
|
635
|
-
# Related: #subtract
|
676
|
+
# Related: #subtract, #|, #&, #^, #~
|
677
|
+
#
|
678
|
+
# ==== Set identities
|
679
|
+
#
|
680
|
+
# <tt>lhs - rhs</tt> is equivalent to:
|
681
|
+
# * <tt>~r - ~l</tt>
|
682
|
+
# * <tt>lhs & ~rhs</tt>
|
683
|
+
# * <tt>~(~lhs | rhs)</tt>
|
684
|
+
# * <tt>lhs & (lhs ^ rhs)</tt>
|
685
|
+
# * <tt>lhs ^ (lhs & rhs)</tt>
|
686
|
+
# * <tt>rhs ^ (lhs | rhs)</tt>
|
636
687
|
def -(other) remain_frozen dup.subtract other end
|
637
688
|
alias difference :-
|
638
689
|
|
@@ -650,7 +701,17 @@ module Net
|
|
650
701
|
# Net::IMAP::SequenceSet[1..5] & [2, 4, 6]
|
651
702
|
# #=> Net::IMAP::SequenceSet["2,4"]
|
652
703
|
#
|
653
|
-
#
|
704
|
+
# Related: #intersect?, #|, #-, #^, #~
|
705
|
+
#
|
706
|
+
# ==== Set identities
|
707
|
+
#
|
708
|
+
# <tt>lhs & rhs</tt> is equivalent to:
|
709
|
+
# * <tt>rhs & lhs</tt> (commutative)
|
710
|
+
# * <tt>~(~lhs | ~rhs)</tt> (De Morgan's Law)
|
711
|
+
# * <tt>lhs - ~rhs</tt>
|
712
|
+
# * <tt>lhs - (lhs - rhs)</tt>
|
713
|
+
# * <tt>lhs - (lhs ^ rhs)</tt>
|
714
|
+
# * <tt>lhs ^ (lhs - rhs)</tt>
|
654
715
|
def &(other)
|
655
716
|
remain_frozen dup.subtract SequenceSet.new(other).complement!
|
656
717
|
end
|
@@ -670,9 +731,17 @@ module Net
|
|
670
731
|
# Net::IMAP::SequenceSet[1..5] ^ [2, 4, 6]
|
671
732
|
# #=> Net::IMAP::SequenceSet["1,3,5:6"]
|
672
733
|
#
|
673
|
-
#
|
674
|
-
#
|
675
|
-
|
734
|
+
# Related: #|, #&, #-, #~
|
735
|
+
#
|
736
|
+
# ==== Set identities
|
737
|
+
#
|
738
|
+
# <tt>lhs ^ rhs</tt> is equivalent to:
|
739
|
+
# * <tt>rhs ^ lhs</tt> (commutative)
|
740
|
+
# * <tt>~lhs ^ ~rhs</tt>
|
741
|
+
# * <tt>(lhs | rhs) - (lhs & rhs)</tt>
|
742
|
+
# * <tt>(lhs - rhs) | (rhs - lhs)</tt>
|
743
|
+
# * <tt>(lhs ^ other) ^ (other ^ rhs)</tt>
|
744
|
+
def ^(other) remain_frozen (dup | other).subtract(self & other) end
|
676
745
|
alias xor :^
|
677
746
|
|
678
747
|
# :call-seq:
|
@@ -689,7 +758,12 @@ module Net
|
|
689
758
|
# ~Net::IMAP::SequenceSet["6:99,223:*"]
|
690
759
|
# #=> Net::IMAP::SequenceSet["1:5,100:222"]
|
691
760
|
#
|
692
|
-
# Related: #complement
|
761
|
+
# Related: #complement!, #|, #&, #-, #^
|
762
|
+
#
|
763
|
+
# ==== Set identities
|
764
|
+
#
|
765
|
+
# <tt>~set</tt> is equivalent to:
|
766
|
+
# * <tt>full - set</tt>, where "full" is Net::IMAP::SequenceSet.full
|
693
767
|
def ~; remain_frozen dup.complement! end
|
694
768
|
alias complement :~
|
695
769
|
|
@@ -701,7 +775,10 @@ module Net
|
|
701
775
|
#
|
702
776
|
# #string will be regenerated. Use #merge to add many elements at once.
|
703
777
|
#
|
704
|
-
#
|
778
|
+
# Use #append to append new elements to #string. See
|
779
|
+
# Net::IMAP@Ordered+and+Normalized+Sets.
|
780
|
+
#
|
781
|
+
# Related: #add?, #merge, #union, #append
|
705
782
|
def add(element)
|
706
783
|
tuple_add input_to_tuple element
|
707
784
|
normalize!
|
@@ -712,6 +789,10 @@ module Net
|
|
712
789
|
#
|
713
790
|
# Unlike #add, #merge, or #union, the new value is appended to #string.
|
714
791
|
# This may result in a #string which has duplicates or is out-of-order.
|
792
|
+
#
|
793
|
+
# See Net::IMAP@Ordered+and+Normalized+Sets.
|
794
|
+
#
|
795
|
+
# Related: #add, #merge, #union
|
715
796
|
def append(entry)
|
716
797
|
modifying!
|
717
798
|
tuple = input_to_tuple entry
|
@@ -860,21 +941,21 @@ module Net
|
|
860
941
|
# This is useful when the given order is significant, for example in a
|
861
942
|
# ESEARCH response to IMAP#sort.
|
862
943
|
#
|
944
|
+
# See Net::IMAP@Ordered+and+Normalized+Sets.
|
945
|
+
#
|
863
946
|
# Related: #each_entry, #elements
|
864
947
|
def entries; each_entry.to_a end
|
865
948
|
|
866
949
|
# Returns an array of ranges and integers and <tt>:*</tt>.
|
867
950
|
#
|
868
951
|
# The returned elements are sorted and coalesced, even when the input
|
869
|
-
# #string is not. <tt>*</tt> will sort last. See #normalize
|
952
|
+
# #string is not. <tt>*</tt> will sort last. See #normalize,
|
953
|
+
# Net::IMAP@Ordered+and+Normalized+Sets.
|
870
954
|
#
|
871
955
|
# By itself, <tt>*</tt> translates to <tt>:*</tt>. A range containing
|
872
956
|
# <tt>*</tt> translates to an endless range. Use #limit to translate both
|
873
957
|
# cases to a maximum value.
|
874
958
|
#
|
875
|
-
# The returned elements will be sorted and coalesced, even when the input
|
876
|
-
# #string is not. <tt>*</tt> will sort last. See #normalize.
|
877
|
-
#
|
878
959
|
# Net::IMAP::SequenceSet["2,5:9,6,*,12:11"].elements
|
879
960
|
# #=> [2, 5..9, 11..12, :*]
|
880
961
|
#
|
@@ -885,15 +966,13 @@ module Net
|
|
885
966
|
# Returns an array of ranges
|
886
967
|
#
|
887
968
|
# The returned elements are sorted and coalesced, even when the input
|
888
|
-
# #string is not. <tt>*</tt> will sort last. See #normalize
|
969
|
+
# #string is not. <tt>*</tt> will sort last. See #normalize,
|
970
|
+
# Net::IMAP@Ordered+and+Normalized+Sets.
|
889
971
|
#
|
890
972
|
# <tt>*</tt> translates to an endless range. By itself, <tt>*</tt>
|
891
973
|
# translates to <tt>:*..</tt>. Use #limit to set <tt>*</tt> to a maximum
|
892
974
|
# value.
|
893
975
|
#
|
894
|
-
# The returned ranges will be sorted and coalesced, even when the input
|
895
|
-
# #string is not. <tt>*</tt> will sort last. See #normalize.
|
896
|
-
#
|
897
976
|
# Net::IMAP::SequenceSet["2,5:9,6,*,12:11"].ranges
|
898
977
|
# #=> [2..2, 5..9, 11..12, :*..]
|
899
978
|
# Net::IMAP::SequenceSet["123,999:*,456:789"].ranges
|
@@ -905,7 +984,7 @@ module Net
|
|
905
984
|
# Returns a sorted array of all of the number values in the sequence set.
|
906
985
|
#
|
907
986
|
# The returned numbers are sorted and de-duplicated, even when the input
|
908
|
-
# #string is not. See #normalize.
|
987
|
+
# #string is not. See #normalize, Net::IMAP@Ordered+and+Normalized+Sets.
|
909
988
|
#
|
910
989
|
# Net::IMAP::SequenceSet["2,5:9,6,12:11"].numbers
|
911
990
|
# #=> [2, 5, 6, 7, 8, 9, 11, 12]
|
@@ -937,6 +1016,8 @@ module Net
|
|
937
1016
|
# no sorting, deduplication, or coalescing. When #string is in its
|
938
1017
|
# normalized form, this will yield the same values as #each_element.
|
939
1018
|
#
|
1019
|
+
# See Net::IMAP@Ordered+and+Normalized+Sets.
|
1020
|
+
#
|
940
1021
|
# Related: #entries, #each_element
|
941
1022
|
def each_entry(&block) # :yields: integer or range or :*
|
942
1023
|
return to_enum(__method__) unless block_given?
|
@@ -947,7 +1028,7 @@ module Net
|
|
947
1028
|
# and returns self. Returns an enumerator when called without a block.
|
948
1029
|
#
|
949
1030
|
# The returned numbers are sorted and de-duplicated, even when the input
|
950
|
-
# #string is not. See #normalize.
|
1031
|
+
# #string is not. See #normalize, Net::IMAP@Ordered+and+Normalized+Sets.
|
951
1032
|
#
|
952
1033
|
# Related: #elements, #each_entry
|
953
1034
|
def each_element # :yields: integer or range or :*
|
@@ -1241,20 +1322,76 @@ module Net
|
|
1241
1322
|
def slice_range(range)
|
1242
1323
|
first = range.begin || 0
|
1243
1324
|
last = range.end || -1
|
1244
|
-
|
1325
|
+
if range.exclude_end?
|
1326
|
+
return remain_frozen_empty if last.zero?
|
1327
|
+
last -= 1 if range.end && last != STAR_INT
|
1328
|
+
end
|
1245
1329
|
if (first * last).positive? && last < first
|
1246
|
-
|
1330
|
+
remain_frozen_empty
|
1247
1331
|
elsif (min = at(first))
|
1248
1332
|
max = at(last)
|
1333
|
+
max = :* if max.nil?
|
1249
1334
|
if max == :* then self & (min..)
|
1250
1335
|
elsif min <= max then self & (min..max)
|
1251
|
-
else
|
1336
|
+
else remain_frozen_empty
|
1252
1337
|
end
|
1253
1338
|
end
|
1254
1339
|
end
|
1255
1340
|
|
1256
1341
|
public
|
1257
1342
|
|
1343
|
+
# Returns a copy of +self+ which only contains the numbers above +num+.
|
1344
|
+
#
|
1345
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].above(10) # to_s => "11:22,50"
|
1346
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].above(20) # to_s => "21:22,50
|
1347
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].above(30) # to_s => "50"
|
1348
|
+
#
|
1349
|
+
# This returns the same result as #intersection with <tt>((num+1)..)</tt>
|
1350
|
+
# or #difference with <tt>(..num)</tt>.
|
1351
|
+
#
|
1352
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] & (11..) # to_s => "11:22,50"
|
1353
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] - (..10) # to_s => "11:22,50"
|
1354
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] & (21..) # to_s => "21:22,50"
|
1355
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] - (..20) # to_s => "21:22,50"
|
1356
|
+
#
|
1357
|
+
# Related: #above, #-, #&
|
1358
|
+
def above(num)
|
1359
|
+
NumValidator.valid_nz_number?(num) or
|
1360
|
+
raise ArgumentError, "not a valid sequence set number"
|
1361
|
+
difference(..num)
|
1362
|
+
end
|
1363
|
+
|
1364
|
+
# Returns a copy of +self+ which only contains numbers below +num+.
|
1365
|
+
#
|
1366
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].below(10) # to_s => "5"
|
1367
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].below(20) # to_s => "5,10:19"
|
1368
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].below(30) # to_s => "5,10:22"
|
1369
|
+
#
|
1370
|
+
# This returns the same result as #intersection with <tt>(..(num-1))</tt>
|
1371
|
+
# or #difference with <tt>(num..)</tt>.
|
1372
|
+
#
|
1373
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] & (..9) # to_s => "5"
|
1374
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] - (10..) # to_s => "5"
|
1375
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] & (..19) # to_s => "5,10:19"
|
1376
|
+
# Net::IMAP::SequenceSet["5,10:22,50"] - (20..) # to_s => "5,10:19"
|
1377
|
+
#
|
1378
|
+
# When the set does not contain <tt>*</tt>, #below is identical to #limit
|
1379
|
+
# with <tt>max: num - 1</tt>. When the set does contain <tt>*</tt>,
|
1380
|
+
# #below always drops it from the result. Use #limit when the IMAP
|
1381
|
+
# semantics for <tt>*</tt> must be enforced.
|
1382
|
+
#
|
1383
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].below(30) # to_s => "5,10:22"
|
1384
|
+
# Net::IMAP::SequenceSet["5,10:22,50"].limit(max: 29) # to_s => "5,10:22"
|
1385
|
+
# Net::IMAP::SequenceSet["5,10:22,*"].below(30) # to_s => "5,10:22"
|
1386
|
+
# Net::IMAP::SequenceSet["5,10:22,*"].limit(max: 29) # to_s => "5,10:22,29"
|
1387
|
+
#
|
1388
|
+
# Related: #above, #-, #&, #limit
|
1389
|
+
def below(num)
|
1390
|
+
NumValidator.valid_nz_number?(num) or
|
1391
|
+
raise ArgumentError, "not a valid sequence set number"
|
1392
|
+
difference(num..)
|
1393
|
+
end
|
1394
|
+
|
1258
1395
|
# Returns a frozen SequenceSet with <tt>*</tt> converted to +max+, numbers
|
1259
1396
|
# and ranges over +max+ removed, and ranges containing +max+ converted to
|
1260
1397
|
# end at +max+.
|
@@ -1272,6 +1409,7 @@ module Net
|
|
1272
1409
|
# Net::IMAP::SequenceSet["500:*"].limit(max: 37)
|
1273
1410
|
# #=> Net::IMAP::SequenceSet["37"]
|
1274
1411
|
#
|
1412
|
+
# Related: #limit!
|
1275
1413
|
def limit(max:)
|
1276
1414
|
max = to_tuple_int(max)
|
1277
1415
|
if empty? then self.class.empty
|
@@ -1313,6 +1451,7 @@ module Net
|
|
1313
1451
|
#
|
1314
1452
|
# The returned set's #string is sorted and deduplicated. Adjacent or
|
1315
1453
|
# overlapping elements will be merged into a single larger range.
|
1454
|
+
# See Net::IMAP@Ordered+and+Normalized+Sets.
|
1316
1455
|
#
|
1317
1456
|
# Net::IMAP::SequenceSet["1:5,3:7,10:9,10:11"].normalize
|
1318
1457
|
# #=> Net::IMAP::SequenceSet["1:7,9:11"]
|
@@ -1325,7 +1464,7 @@ module Net
|
|
1325
1464
|
end
|
1326
1465
|
|
1327
1466
|
# Resets #string to be sorted, deduplicated, and coalesced. Returns
|
1328
|
-
# +self+.
|
1467
|
+
# +self+. See Net::IMAP@Ordered+and+Normalized+Sets.
|
1329
1468
|
#
|
1330
1469
|
# Related: #normalize, #normalized_string
|
1331
1470
|
def normalize!
|
@@ -1335,11 +1474,13 @@ module Net
|
|
1335
1474
|
|
1336
1475
|
# Returns a normalized +sequence-set+ string representation, sorted
|
1337
1476
|
# and deduplicated. Adjacent or overlapping elements will be merged into
|
1338
|
-
# a single larger range.
|
1477
|
+
# a single larger range. See Net::IMAP@Ordered+and+Normalized+Sets.
|
1339
1478
|
#
|
1340
1479
|
# Net::IMAP::SequenceSet["1:5,3:7,10:9,10:11"].normalized_string
|
1341
1480
|
# #=> "1:7,9:11"
|
1342
1481
|
#
|
1482
|
+
# Returns +nil+ when the set is empty.
|
1483
|
+
#
|
1343
1484
|
# Related: #normalize!, #normalize
|
1344
1485
|
def normalized_string
|
1345
1486
|
@tuples.empty? ? nil : -@tuples.map { tuple_to_str _1 }.join(",")
|
@@ -1388,6 +1529,7 @@ module Net
|
|
1388
1529
|
private
|
1389
1530
|
|
1390
1531
|
def remain_frozen(set) frozen? ? set.freeze : set end
|
1532
|
+
def remain_frozen_empty; frozen? ? SequenceSet.empty : SequenceSet.new end
|
1391
1533
|
|
1392
1534
|
# frozen clones are shallow copied
|
1393
1535
|
def initialize_clone(other)
|
data/lib/net/imap.rb
CHANGED
@@ -788,7 +788,7 @@ module Net
|
|
788
788
|
# * {IMAP URLAUTH Authorization Mechanism Registry}[https://www.iana.org/assignments/urlauth-authorization-mechanism-registry/urlauth-authorization-mechanism-registry.xhtml]
|
789
789
|
#
|
790
790
|
class IMAP < Protocol
|
791
|
-
VERSION = "0.5.
|
791
|
+
VERSION = "0.5.8"
|
792
792
|
|
793
793
|
# Aliases for supported capabilities, to be used with the #enable command.
|
794
794
|
ENABLE_ALIASES = {
|