Module: FabricCA::Configuration

Included in:
FabricCA
Defined in:
lib/fabric_ca/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
%i[endpoint ca_name identity
username password logger
connection_opts].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



9
10
11
# File 'lib/fabric_ca/configuration.rb', line 9

def self.extended(base)
  base.reset
end

Instance Method Details

#assign(config) ⇒ Object



27
28
29
# File 'lib/fabric_ca/configuration.rb', line 27

def assign(config)
  VALID_OPTIONS_KEYS.each { |key| send("#{key}=", config[key]) if config.key?(key) }
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



13
14
15
# File 'lib/fabric_ca/configuration.rb', line 13

def configure
  yield self
end

#optionsObject



17
18
19
20
21
# File 'lib/fabric_ca/configuration.rb', line 17

def options
  VALID_OPTIONS_KEYS.inject({}) do |option, key|
    option.merge!(key => send(key))
  end
end

#resetObject



23
24
25
# File 'lib/fabric_ca/configuration.rb', line 23

def reset
  VALID_OPTIONS_KEYS.each { |key| send("#{key}=", nil) }
end