Skip to content

Commit 566e668

Browse files
committed
🔧 Set responses_without_block to frozen_dup in 0.6
This seems like a better API than _always_ crashing. Now that we have a config option for it, it should become the default in v0.6.
1 parent 5ac99b2 commit 566e668

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

lib/net/imap.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,11 +2528,11 @@ def idle_done
25282528
# Prints a warning and returns the mutable responses hash.
25292529
# <em>This is not thread-safe.</em>
25302530
#
2531-
# [+:frozen_dup+</em>]
2531+
# [+:frozen_dup+ <em>(planned default for +v0.6+)</em>]
25322532
# Returns a frozen copy of the unhandled responses hash, with frozen
25332533
# array values.
25342534
#
2535-
# [+:raise+ <em>(planned future default)</em>]
2535+
# [+:raise+]
25362536
# Raise an +ArgumentError+ with the deprecation warning.
25372537
#
25382538
# For example:

lib/net/imap/config.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def self.[](config)
260260
# Prints a warning and returns the mutable responses hash.
261261
# <em>This is not thread-safe.</em>
262262
#
263-
# [+:frozen_dup+</em>]
263+
# [+:frozen_dup+ <em>(planned default for +v0.6+)</em>]
264264
# Returns a frozen copy of the unhandled responses hash, with frozen
265265
# array values.
266266
#
@@ -269,7 +269,7 @@ def self.[](config)
269269
#
270270
# <em>(+:frozen_dup+ config option was added in +v0.4.17+)</em>
271271
#
272-
# [+:raise+ <em>(planned future default)</em>]
272+
# [+:raise+]
273273
# Raise an ArgumentError with the deprecation warning.
274274
#
275275
# Note: #responses_without_args is an alias for #responses_without_block.
@@ -388,12 +388,11 @@ def defaults_hash
388388

389389
version_defaults[0.5] = Config[:current]
390390

391-
version_defaults[0.6] = Config[0.5]
392-
version_defaults[:next] = Config[0.6]
393-
394-
version_defaults[:future] = Config[0.6].dup.update(
395-
responses_without_block: :raise,
391+
version_defaults[0.6] = Config[0.5].dup.update(
392+
responses_without_block: :frozen_dup,
396393
).freeze
394+
version_defaults[:next] = Config[0.6]
395+
version_defaults[:future] = Config[:next]
397396

398397
version_defaults.freeze
399398
end

test/net/imap/test_config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ class ConfigTest < Test::Unit::TestCase
190190
assert_same Config.default, Config.new(Config.default).parent
191191
assert_same Config.global, Config.new(Config.global).parent
192192
assert_same Config[0.4], Config.new(0.4).parent
193-
assert_same Config[0.5], Config.new(:next).parent
193+
assert_same Config[0.6], Config.new(:next).parent
194194
assert_equal true, Config.new({debug: true}, debug: false).parent.debug?
195195
assert_equal true, Config.new({debug: true}, debug: false).parent.frozen?
196196
end

0 commit comments

Comments
 (0)