Skip to content

Commit 3f966c9

Browse files
committed
Remove the deep dup in Client#options
1 parent ea89435 commit 3f966c9

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

lib/redis/client.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ class Client
2222
:inherit_socket => false
2323
}
2424

25-
def options
26-
Marshal.load(Marshal.dump(@options))
27-
end
25+
attr_reader :options
2826

2927
def scheme
3028
@options[:scheme]

test/internals_test.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,6 @@ def test_client_options
349349
assert_equal "foo", redis.client.options[:scheme]
350350
end
351351

352-
def test_does_not_change_self_client_options
353-
redis = Redis.new(OPTIONS.merge(:host => "host", :port => 1234, :db => 1, :scheme => "foo"))
354-
options = redis.client.options
355-
356-
options[:host] << "new_host"
357-
options[:scheme] << "bar"
358-
options.merge!(:db => 0)
359-
360-
assert_equal "host", redis.client.options[:host]
361-
assert_equal 1, redis.client.options[:db]
362-
assert_equal "foo", redis.client.options[:scheme]
363-
end
364-
365352
def test_resolves_localhost
366353
assert_nothing_raised do
367354
Redis.new(OPTIONS.merge(:host => 'localhost')).ping

0 commit comments

Comments
 (0)