From 9783d7f21c4ddc43b845a6c551d954adaab57a7e Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Wed, 19 Feb 2020 04:44:31 +0000 Subject: config: remove deprecated methods Remove 4 deprecated methods. The following two methods have been marked as deprecated since 2003, by r4531 (ruby.git commit 78ff3833fb67c8005a9b851037e74b3eea940aa3). - OpenSSL::Config#value - OpenSSL::Config#section Other two methods are removed because the corresponding functions disappeared in OpenSSL 1.1.0. - OpenSSL::Config#add_value - OpenSSL::Config#[]= --- lib/openssl/config.rb | 90 --------------------------------------------------- 1 file changed, 90 deletions(-) (limited to 'lib') diff --git a/lib/openssl/config.rb b/lib/openssl/config.rb index 9a0b7874..46e1711d 100644 --- a/lib/openssl/config.rb +++ b/lib/openssl/config.rb @@ -297,50 +297,6 @@ module OpenSSL get_key_string(section, key) end - ## - # - # *Deprecated* - # - # Use #get_value instead - def value(arg1, arg2 = nil) # :nodoc: - warn('Config#value is deprecated; use Config#get_value') - if arg2.nil? - section, key = 'default', arg1 - else - section, key = arg1, arg2 - end - section ||= 'default' - section = 'default' if section.empty? - get_key_string(section, key) - end - - ## - # *Deprecated in v2.2.0*. This method will be removed in a future release. - # - # Set the target _key_ with a given _value_ under a specific _section_. - # - # Given the following configurating file being loaded: - # - # config = OpenSSL::Config.load('foo.cnf') - # #=> # - # puts config.to_s - # #=> [ default ] - # # foo=bar - # - # You can set the value of _foo_ under the _default_ section to a new - # value: - # - # config.add_value('default', 'foo', 'buzz') - # #=> "buzz" - # puts config.to_s - # #=> [ default ] - # # foo=buzz - # - def add_value(section, key, value) - check_modify - (@data[section] ||= {})[key] = value - end - ## # Get a specific _section_ from the current configuration # @@ -361,46 +317,6 @@ module OpenSSL @data[section] || {} end - ## - # Deprecated - # - # Use #[] instead - def section(name) # :nodoc: - warn('Config#section is deprecated; use Config#[]') - @data[name] || {} - end - - ## - # *Deprecated in v2.2.0*. This method will be removed in a future release. - # - # Sets a specific _section_ name with a Hash _pairs_. - # - # Given the following configuration being created: - # - # config = OpenSSL::Config.new - # #=> # - # config['default'] = {"foo"=>"bar","baz"=>"buz"} - # #=> {"foo"=>"bar", "baz"=>"buz"} - # puts config.to_s - # #=> [ default ] - # # foo=bar - # # baz=buz - # - # It's important to note that this will essentially merge any of the keys - # in _pairs_ with the existing _section_. For example: - # - # config['default'] - # #=> {"foo"=>"bar", "baz"=>"buz"} - # config['default'] = {"foo" => "changed"} - # #=> {"foo"=>"changed"} - # config['default'] - # #=> {"foo"=>"changed", "baz"=>"buz"} - # - def []=(section, pairs) - check_modify - set_section(section, pairs) - end - def set_section(section, pairs) # :nodoc: hash = @data[section] ||= {} pairs.each do |key, value| @@ -488,12 +404,6 @@ module OpenSSL @data = other.data.dup end - def check_modify - warn "#{caller(2, 1)[0]}: warning: do not modify OpenSSL::Config; this " \ - "method is deprecated and will be removed in a future release." - raise TypeError.new("Insecure: can't modify OpenSSL config") if frozen? - end - def get_key_string(section, key) Config.get_key_string(@data, section, key) end -- cgit v1.2.3