Class: KubeManifest::Context
- Inherits:
-
Object
- Object
- KubeManifest::Context
- Defined in:
- lib/kube_manifest/core.rb
Instance Attribute Summary collapse
-
#cwd ⇒ Object
Returns the value of attribute cwd.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
- #as_hash ⇒ Object
- #as_yaml ⇒ Object
- #evaluate(overriding: nil) ⇒ Object
-
#initialize(klass, args, &blk) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(klass, args, &blk) ⇒ Context
Returns a new instance of Context.
5 6 7 8 |
# File 'lib/kube_manifest/core.rb', line 5 def initialize(klass, args, &blk) @klass, @args, @blk = klass, args, blk @cwd, @values = [], {} end |
Instance Attribute Details
#cwd ⇒ Object
Returns the value of attribute cwd.
3 4 5 |
# File 'lib/kube_manifest/core.rb', line 3 def cwd @cwd end |
#values ⇒ Object
Returns the value of attribute values.
3 4 5 |
# File 'lib/kube_manifest/core.rb', line 3 def values @values end |
Instance Method Details
#as_hash ⇒ Object
28 29 30 |
# File 'lib/kube_manifest/core.rb', line 28 def as_hash self.evaluate.as_hash end |
#as_yaml ⇒ Object
32 33 34 |
# File 'lib/kube_manifest/core.rb', line 32 def as_yaml self.evaluate.as_yaml end |
#evaluate(overriding: nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kube_manifest/core.rb', line 10 def evaluate(overriding: nil) if overriding @cwd = overriding.cwd @values = overriding.values end @manifest = @klass.new(ctx: self, values: @values) @manifest.instance_eval(&@blk) if @blk @args.each_pair do |k, v| @manifest.send(k, v) end @manifest end |