Skip to content

Commit b01d864

Browse files
committed
💥 Only Array inputs to SequenceSet may be nested
Other enumerable types are no longer valid inputs.
1 parent ab4f80e commit b01d864

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/net/imap/sequence_set.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class IMAP
3737
#
3838
# SequenceSet.new may receive a single optional argument: a non-zero 32 bit
3939
# unsigned integer, a range, a <tt>sequence-set</tt> formatted string,
40-
# another sequence set, a Set (containing only numbers), or an enumerable
41-
# containing any of these (which may be nested).
40+
# another sequence set, a Set (containing only numbers), or an Array
41+
# containing any of these (array inputs may be nested).
4242
#
4343
# set = Net::IMAP::SequenceSet.new(1)
4444
# set.valid_string #=> "1"
@@ -290,8 +290,7 @@ class SequenceSet
290290
private_constant :STAR_INT, :STARS
291291

292292
COERCIBLE = ->{ _1.respond_to? :to_sequence_set }
293-
ENUMABLE = ->{ _1.respond_to?(:each) && _1.respond_to?(:empty?) }
294-
private_constant :COERCIBLE, :ENUMABLE
293+
private_constant :COERCIBLE
295294

296295
class << self
297296

@@ -1273,7 +1272,7 @@ def input_to_tuples(obj)
12731272
when String then str_to_tuples obj
12741273
when SequenceSet then obj.tuples
12751274
when Set then obj.map { to_tuple_int _1 }
1276-
when ENUMABLE then obj.flat_map { input_to_tuples _1 }
1275+
when Array then obj.flat_map { input_to_tuples _1 }
12771276
when nil then []
12781277
else
12791278
raise DataFormatError,

0 commit comments

Comments
 (0)