Method: OpenSSL::Config#initialize

Defined in:
lib/openssl/config.rb

#initialize(filename = nil) ⇒ Config

Creates an instance of OpenSSL’s configuration class.

This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=

If the optional filename parameter is provided, then it is read in and parsed via #parse_config.

This can raise IO exceptions based on the access, or availability of the file. A ConfigError exception may be raised depending on the validity of the data being configured.



267
268
269
270
271
272
273
274
275
276
# File 'lib/openssl/config.rb', line 267

def initialize(filename = nil)
  @data = {}
  if filename
    File.open(filename.to_s) do |file|
      Config.parse_config(file).each do |section, hash|
        set_section(section, hash)
      end
    end
  end
end