Class: Kubec::Kubernetes::Config
- Inherits:
-
Hash
- Object
- Hash
- Kubec::Kubernetes::Config
show all
- Extended by:
- Forwardable
- Defined in:
- lib/kubec/kubernetes/config.rb
Overview
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name, &block) ⇒ Config
Returns a new instance of Config.
24
25
26
27
28
|
# File 'lib/kubec/kubernetes/config.rb', line 24
def initialize(name, &block)
@name = name.to_sym
prepare
instance_eval(&block)
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9
10
11
|
# File 'lib/kubec/kubernetes/config.rb', line 9
def name
@name
end
|
Class Method Details
.api_version(version = nil) ⇒ Object
14
15
16
17
|
# File 'lib/kubec/kubernetes/config.rb', line 14
def api_version(version = nil)
return @api_version if version.nil?
@api_version = version
end
|
.kind ⇒ Object
19
20
21
|
# File 'lib/kubec/kubernetes/config.rb', line 19
def kind
name.split('::').last
end
|
Instance Method Details
#fetch(*args) ⇒ Object
TODO: Refactor this feature
31
32
33
|
# File 'lib/kubec/kubernetes/config.rb', line 31
def fetch(*args)
Environment.instance.fetch(*args)
end
|
39
40
41
42
|
# File 'lib/kubec/kubernetes/config.rb', line 39
def metadata(&block)
return self[:metadata] unless block_given?
self[:metadata].instance_eval(&block)
end
|
#prepare ⇒ Object
44
45
46
47
48
49
|
# File 'lib/kubec/kubernetes/config.rb', line 44
def prepare
self[:apiVersion] = self.class.api_version
self[:kind] = self.class.kind
self[:metadata] = Metadata.new(@name)
self[:spec] = {}
end
|
#spec ⇒ Object
35
36
37
|
# File 'lib/kubec/kubernetes/config.rb', line 35
def spec
self[:spec]
end
|