Skip to content

Commit abede07

Browse files
committed
♻️ Allow Config[version] to work up to v1.0
This also causes Config[0.7r] through Config[1.0r] to be aliases (rather than clones) of each other.
1 parent 19c093d commit abede07

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

lib/net/imap/config.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,12 +512,6 @@ def defaults_hash
512512
parser_max_deprecated_uidplus_data_size: 0,
513513
}
514514

515-
version_defaults[0.7r] = {
516-
}
517-
518-
version_defaults[0.8r] = {
519-
}
520-
521515
AttrVersionDefaults.compile_version_defaults!
522516

523517
if ($VERBOSE || $DEBUG) && self[:current].to_h != self[:default].to_h

lib/net/imap/config/attr_version_defaults.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ module AttrVersionDefaults
1919
NEXT_VERSION = CURRENT_VERSION + 0.1r
2020

2121
# The config version used for <tt>Config[:future]</tt>.
22-
FUTURE_VERSION = CURRENT_VERSION + 0.2r
22+
FUTURE_VERSION = 1.0r
2323

24-
VERSIONS = ((0.0r..0.8r) % 0.1r).to_a.freeze
24+
VERSIONS = ((0.0r..FUTURE_VERSION) % 0.1r).to_a.freeze
2525

2626
# See Config.version_defaults.
2727
singleton_class.attr_accessor :version_defaults

test/net/imap/test_config.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ConfigTest < Net::IMAP::TestCase
77
Config = Net::IMAP::Config
88
THIS_VERSION = Net::IMAP::VERSION.to_f
99
NEXT_VERSION = THIS_VERSION + 0.1
10-
FUTURE_VERSION = THIS_VERSION + 0.2
10+
FUTURE_VERSION = 1.0
1111

1212
setup do
1313
Config.global.reset
@@ -184,8 +184,7 @@ class ConfigTest < Net::IMAP::TestCase
184184
assert_raise(RangeError) do Config[0.01] end
185185
assert_raise(RangeError) do Config[0.11] end
186186
assert_raise(RangeError) do Config[0.111] end
187-
assert_raise(RangeError) do Config[0.9] end
188-
assert_raise(RangeError) do Config[1] end
187+
assert_raise(RangeError) do Config[1.1] end
189188
end
190189

191190
test ".[] key errors" do

0 commit comments

Comments
 (0)