Class: JamesBond::MissionKubernetes::Config
- Inherits:
-
Object
- Object
- JamesBond::MissionKubernetes::Config
- Defined in:
- lib/james_bond/mission_kubernetes/config.rb
Instance Attribute Summary collapse
-
#raw_hash ⇒ Object
Returns the value of attribute raw_hash.
-
#yaml_path ⇒ Object
Returns the value of attribute yaml_path.
Instance Method Summary collapse
- #for(env:, command:) ⇒ Object
-
#initialize(yaml_path:) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(yaml_path:) ⇒ Config
Returns a new instance of Config.
9 10 11 12 |
# File 'lib/james_bond/mission_kubernetes/config.rb', line 9 def initialize(yaml_path:) @yaml_path = yaml_path extract_config_from_yaml(@yaml_path) end |
Instance Attribute Details
#raw_hash ⇒ Object
Returns the value of attribute raw_hash.
6 7 8 |
# File 'lib/james_bond/mission_kubernetes/config.rb', line 6 def raw_hash @raw_hash end |
#yaml_path ⇒ Object
Returns the value of attribute yaml_path.
6 7 8 |
# File 'lib/james_bond/mission_kubernetes/config.rb', line 6 def yaml_path @yaml_path end |
Instance Method Details
#for(env:, command:) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/james_bond/mission_kubernetes/config.rb', line 15 def for(env:,command:) env_config = @raw_hash[env] raise "No config for '#{env}' environment" if !env_config commands = env_config.fetch("commands", proc { raise_error(command, env)} ) commands.fetch(command, proc { raise_error(command, env) }) end |