Class: Precursor::ConfigRootBuilder
- Inherits:
-
Object
- Object
- Precursor::ConfigRootBuilder
- Defined in:
- lib/config_root_builder.rb
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.
8 9 10 11 |
# File 'lib/config_root_builder.rb', line 8 def initialize @vaults = [] @key_builders = {} end |
Instance Method Details
#build ⇒ Object
23 24 25 26 |
# File 'lib/config_root_builder.rb', line 23 def build = @key_builders.transform_values(&:build) ConfigRoot.new(@vaults, ) end |
#key(key_name) {|builder| ... } ⇒ Object
17 18 19 20 21 |
# File 'lib/config_root_builder.rb', line 17 def key(key_name) builder = ConfigKeyBuilder.new @key_builders[key_name] = builder yield builder end |
#vault(vault) ⇒ Object
13 14 15 |
# File 'lib/config_root_builder.rb', line 13 def vault(vault) @vaults.push(vault) end |