Class: Precursor::ConfigRootBuilder
- Inherits:
-
Object
- Object
- Precursor::ConfigRootBuilder
- Defined in:
- lib/config_root_builder.rb
Overview
A builder to set up Precurcor
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ ConfigRootBuilder
constructor
A new instance of ConfigRootBuilder.
- #key(key_name) {|builder| ... } ⇒ Object
- #vault(vault) ⇒ Object
Constructor Details
#initialize ⇒ ConfigRootBuilder
Returns a new instance of ConfigRootBuilder.
9 10 11 12 |
# File 'lib/config_root_builder.rb', line 9 def initialize @vaults = [] @key_builders = {} end |
Instance Method Details
#build ⇒ Object
24 25 26 27 |
# File 'lib/config_root_builder.rb', line 24 def build = @key_builders.transform_values(&:build) ConfigRoot.new(@vaults, ) end |
#key(key_name) {|builder| ... } ⇒ Object
18 19 20 21 22 |
# File 'lib/config_root_builder.rb', line 18 def key(key_name) builder = ConfigKeyBuilder.new @key_builders[key_name] = builder yield builder end |
#vault(vault) ⇒ Object
14 15 16 |
# File 'lib/config_root_builder.rb', line 14 def vault(vault) @vaults.push(vault) end |