Skip to content

Commit 0c8df40

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 2c8b6da commit 0c8df40

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

lib/net/imap.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,11 +2534,11 @@ def idle_done
25342534
# Prints a warning and returns the mutable responses hash.
25352535
# <em>This is not thread-safe.</em>
25362536
#
2537-
# [+:frozen_dup+</em>]
2537+
# [+:frozen_dup+ <em>(planned default for +v0.6+)</em>]
25382538
# Returns a frozen copy of the unhandled responses hash, with frozen
25392539
# array values.
25402540
#
2541-
# [+:raise+ <em>(planned future default)</em>]
2541+
# [+:raise+]
25422542
# Raise an +ArgumentError+ with the deprecation warning.
25432543
#
25442544
# For example:

lib/net/imap/config.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def self.[](config)
237237
# Prints a warning and returns the mutable responses hash.
238238
# <em>This is not thread-safe.</em>
239239
#
240-
# [+:frozen_dup+</em>]
240+
# [+:frozen_dup+ <em>(planned default for +v0.6+)</em>]
241241
# Returns a frozen copy of the unhandled responses hash, with frozen
242242
# array values.
243243
#
@@ -246,7 +246,7 @@ def self.[](config)
246246
#
247247
# <em>(+:frozen_dup+ config option was added in +v0.4.17+)</em>
248248
#
249-
# [+:raise+ <em>(planned future default)</em>]
249+
# [+:raise+]
250250
# Raise an ArgumentError with the deprecation warning.
251251
#
252252
# Note: #responses_without_args is an alias for #responses_without_block.
@@ -363,9 +363,10 @@ def defaults_hash
363363
version_defaults[:current] = Config[0.4]
364364
version_defaults[:next] = Config[0.5]
365365

366-
version_defaults[:future] = Config[0.5].dup.update(
367-
responses_without_block: :raise,
366+
version_defaults[0.6] = Config[0.5].dup.update(
367+
responses_without_block: :frozen_dup,
368368
).freeze
369+
version_defaults[:future] = Config[0.6]
369370

370371
version_defaults.freeze
371372
end

test/net/imap/test_config.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ class ConfigTest < Test::Unit::TestCase
191191
assert_same Config.global, Config.new(Config.global).parent
192192
assert_same Config[0.4], Config.new(0.4).parent
193193
assert_same Config[0.5], Config.new(:next).parent
194+
assert_same Config[0.6], Config.new(:future).parent
194195
assert_equal true, Config.new({debug: true}, debug: false).parent.debug?
195196
assert_equal true, Config.new({debug: true}, debug: false).parent.frozen?
196197
end

0 commit comments

Comments
 (0)