End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
OpenSSL::Config#[]=
[]=(section, pairs)
ext/openssl/lib/openssl/config.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/ext/openssl/lib/openssl/config.rb, line 399
def []=(section, pairs)
check_modify
set_section(section, pairs)
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:
Example
config = OpenSSL::Config.new #=> #<OpenSSL::Config sections=[]> 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:
Example
config['default'] #=> {"foo"=>"bar", "baz"=>"buz"} config['default'] = {"foo" => "changed"} #=> {"foo"=>"changed"} config['default'] #=> {"foo"=>"changed", "baz"=>"buz"}