Skip to content

Commit 6ef2573

Browse files
committed
🐛 Config version_defaults should be attr_reader
Although `version_defaults` is deeply frozen, it used `attr_accessor`!
1 parent 38622aa commit 6ef2573

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/net/imap/config/attr_version_defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module AttrVersionDefaults
2424
VERSIONS = ((0.0r..FUTURE_VERSION) % 0.1r).to_a.freeze
2525

2626
# See Config.version_defaults.
27-
singleton_class.attr_accessor :version_defaults
27+
singleton_class.attr_reader :version_defaults
2828

2929
@version_defaults = Hash.new {|h, k|
3030
# NOTE: String responds to both so the order is significant.

test/net/imap/test_config.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ class ConfigTest < Net::IMAP::TestCase
151151
end
152152
assert_same Config.global, config.parent
153153
end
154+
assert_raise(NameError) do Config.method(:version_defaults=) end
155+
assert_raise(NameError) do
156+
Config::AttrVersionDefaults.method(:version_defaults=)
157+
end
154158
end
155159

156160
test "Config[:default] and Config[:current] both hold default config" do

0 commit comments

Comments
 (0)