class R509::Config::CAConfigPool
pool of configs, so we can support multiple CAs from a single config file
Public Class Methods
from_yaml(name, yaml_data, opts = {})
click to toggle source
Loads the named configuration config from a yaml string. @param [String] name The name of the config within the file. Note
that a single yaml file can contain more than one configuration.
@param [String] yaml_data The filename to load yaml config data from.
# File lib/r509/config/ca_config.rb, line 52 def self.from_yaml(name, yaml_data, opts = {}) conf = YAML.load(yaml_data) configs = {} conf[name].each_pair do |ca_name, data| configs[ca_name] = R509::Config::CAConfig.load_from_hash(data, opts) end R509::Config::CAConfigPool.new(configs) end
new(configs)
click to toggle source
@option configs [Hash<String, R509::Config::CAConfig>] the configs to add to the pool
# File lib/r509/config/ca_config.rb, line 19 def initialize(configs) @configs = configs end
Public Instance Methods
[](name)
click to toggle source
retrieve a particular config by its name
# File lib/r509/config/ca_config.rb, line 29 def [](name) @configs[name] end
all()
click to toggle source
@return a list of all the configs in this pool
# File lib/r509/config/ca_config.rb, line 34 def all @configs.values end
names()
click to toggle source
get all the config names
# File lib/r509/config/ca_config.rb, line 24 def names @configs.keys end
to_h()
click to toggle source
@return [Hash]
# File lib/r509/config/ca_config.rb, line 39 def to_h @configs.merge(@configs) { |_k, v| v.to_h } end
to_yaml()
click to toggle source
@return [YAML]
# File lib/r509/config/ca_config.rb, line 44 def to_yaml self.to_h.to_yaml end