class OpenSSL::Config

def to_s


baz=buz
foo=bar
#=> [ default ]
puts new_config
#=> #
new_config = OpenSSL::Config.parse(serialized_config)
# much later...
serialized_config = config.to_s

it later:
You can parse get the serialized configuration using #to_s and then parse

# baz=buz
# foo=bar
#=> [ default ]
puts config.to_s
#=> {"foo"=>"bar", "baz"=>"buz"}
config['default'] = {"foo"=>"bar","baz"=>"buz"}
#=> #
config = OpenSSL::Config.new

Given the following configuration being created:

Get the parsable form of the current configuration
#
def to_s
  ary = []
  @data.keys.sort.each do |section|
    ary << "[ #{section} ]\n"
    @data[section].keys.each do |key|
      ary << "#{key}=#{@data[section][key]}\n"
    end
    ary << "\n"
  end
  ary.join
end