Class: Kuby::Kubernetes::Manifest
- Inherits:
-
Object
- Object
- Kuby::Kubernetes::Manifest
- Includes:
- Enumerable
- Defined in:
- lib/kuby/kubernetes/manifest.rb
Instance Method Summary collapse
- #<<(resource) ⇒ Object
- #delete(kind, name) ⇒ Object
- #each(&block) ⇒ Object
- #find(kind, name) ⇒ Object
-
#initialize(resources) ⇒ Manifest
constructor
A new instance of Manifest.
Constructor Details
#initialize(resources) ⇒ Manifest
Returns a new instance of Manifest.
9 10 11 12 13 |
# File 'lib/kuby/kubernetes/manifest.rb', line 9 def initialize(resources) @resources = resources ensure_all_resources_unique! end |
Instance Method Details
#<<(resource) ⇒ Object
33 34 35 |
# File 'lib/kuby/kubernetes/manifest.rb', line 33 def <<(resource) @resources << resource end |
#delete(kind, name) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/kuby/kubernetes/manifest.rb', line 25 def delete(kind, name) idx = @resources.index do |resource| matches?(resource, kind, name) end resources.delete(idx) if idx end |
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/kuby/kubernetes/manifest.rb', line 15 def each(&block) @resources.each(&block) end |
#find(kind, name) ⇒ Object
19 20 21 22 23 |
# File 'lib/kuby/kubernetes/manifest.rb', line 19 def find(kind, name) @resources.find do |resource| matches?(resource, kind, name) end end |