Class: MakeMeSpiffy::OutputTemplateManifest
- Inherits:
-
Object
- Object
- MakeMeSpiffy::OutputTemplateManifest
- Defined in:
- lib/makemespiffy/output_template_manifest.rb
Instance Attribute Summary collapse
-
#manifest ⇒ Object
readonly
Returns the value of attribute manifest.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(bosh_manifest_yaml) ⇒ OutputTemplateManifest
constructor
A new instance of OutputTemplateManifest.
-
#insert_scope_value(meta_scope, value) ⇒ Object
Usage: insert_scope_value(“meta.foo.bar”, 1234) Will add the following into manifest YAML meta: foo: bar: 1234.
Constructor Details
#initialize(bosh_manifest_yaml) ⇒ OutputTemplateManifest
Returns a new instance of OutputTemplateManifest.
16 17 18 |
# File 'lib/makemespiffy/output_template_manifest.rb', line 16 def initialize(bosh_manifest_yaml) @manifest = bosh_manifest_yaml end |
Instance Attribute Details
#manifest ⇒ Object (readonly)
Returns the value of attribute manifest.
5 6 7 |
# File 'lib/makemespiffy/output_template_manifest.rb', line 5 def manifest @manifest end |
Class Method Details
.from_file(manifest_path) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/makemespiffy/output_template_manifest.rb', line 7 def self.from_file(manifest_path) if File.exist?(manifest_path) file = YAML.load_file(manifest_path) else file = {} end self.new(file) end |
Instance Method Details
#insert_scope_value(meta_scope, value) ⇒ Object
Usage: insert_scope_value(“meta.foo.bar”, 1234) Will add the following into manifest YAML
meta:
foo:
bar: 1234
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/makemespiffy/output_template_manifest.rb', line 25 def insert_scope_value(, value) parts = .split('.') submanifest = manifest scoping_parts, key = parts[0..-2], parts[-1] for part in scoping_parts submanifest[part] ||= {} submanifest = submanifest[part] end submanifest[key] = value end |