Class: KubeManifest::Spec
- Inherits:
-
Object
- Object
- KubeManifest::Spec
- Extended by:
- DescribeHelper
- Includes:
- SpecUtils
- Defined in:
- lib/kube_manifest/spec.rb,
lib/kube_manifest/spec/job.rb,
lib/kube_manifest/spec/pod.rb,
lib/kube_manifest/spec/core.rb,
lib/kube_manifest/spec/config.rb,
lib/kube_manifest/spec/cronjob.rb,
lib/kube_manifest/spec/service.rb,
lib/kube_manifest/spec/storage.rb,
lib/kube_manifest/spec/container.rb,
lib/kube_manifest/spec/deployment.rb,
lib/kube_manifest/spec/replicaset.rb
Direct Known Subclasses
Capabilities, ClientIPConfig, ConfigMap, ConfigMapEnvSource, ConfigMapKeySelector, ConfigMapVolumeSource, Container, ContainerPort, CronJob, CronJobSpec, Deployment, DeploymentSpec, DeploymentStrategy, EnvFromSource, EnvVar, EnvVarSource, ExecAction, HTTPGetAction, Handler, HostAlias, HostPathVolumeSource, Job, JobSpec, JobTemplateSpec, KeyToPath, LabelSelector, LabelSelectorRequirement, LifeCycle, ObjectFieldSelector, ObjectMeta, PersistentVolumeClaim, PersistentVolumeClaimSpec, PersistentVolumeClaimVolumeSource, Pod, PodSpec, PodTemplateSpec, Probe, ReplicaSet, ReplicaSetSpec, ResourceFieldSelector, ResourceRequirements, RollingUpdateDeployment, SELinuxOptions, Secret, SecretEnvSource, SecretKeySelector, SecretVolumeSource, SecurityContext, Service, ServicePort, ServiceSpec, SessionAffinityConfig, TCPSocketAction, TypedLocalObjectReference, Volume, VolumeDevice, VolumeMount, WindowsSecurityContextOptions
Defined Under Namespace
Classes: Capabilities, ClientIPConfig, ConfigMap, ConfigMapEnvSource, ConfigMapKeySelector, ConfigMapVolumeSource, Container, ContainerPort, CronJob, CronJobSpec, Deployment, DeploymentSpec, DeploymentStrategy, EnvFromSource, EnvVar, EnvVarSource, ExecAction, HTTPGetAction, Handler, HostAlias, HostPathVolumeSource, Job, JobSpec, JobTemplateSpec, KeyToPath, LabelSelector, LabelSelectorRequirement, LifeCycle, ObjectFieldSelector, ObjectMeta, PersistentVolumeClaim, PersistentVolumeClaimSpec, PersistentVolumeClaimVolumeSource, Pod, PodSpec, PodTemplateSpec, Probe, ReplicaSet, ReplicaSetSpec, ResourceFieldSelector, ResourceRequirements, RollingUpdateDeployment, SELinuxOptions, Secret, SecretEnvSource, SecretKeySelector, SecretVolumeSource, SecurityContext, Service, ServicePort, ServiceSpec, SessionAffinityConfig, TCPSocketAction, TypedLocalObjectReference, Volume, VolumeDevice, VolumeMount, WindowsSecurityContextOptions
Instance Attribute Summary collapse
-
#_ctx ⇒ Object
Returns the value of attribute _ctx.
-
#_values ⇒ Object
Returns the value of attribute _values.
Instance Method Summary collapse
- #as_hash(stringify_keys = false) ⇒ Object
- #as_yaml ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(ctx: nil, values: {}) ⇒ Spec
constructor
A new instance of Spec.
Methods included from DescribeHelper
Methods included from SpecUtils
child_node, child_value, children_node, children_value, included
Constructor Details
#initialize(ctx: nil, values: {}) ⇒ Spec
Returns a new instance of Spec.
106 107 108 109 |
# File 'lib/kube_manifest/spec.rb', line 106 def initialize(ctx: nil, values: {}) @_ctx = ctx @_values = values end |
Instance Attribute Details
#_ctx ⇒ Object
Returns the value of attribute _ctx.
103 104 105 |
# File 'lib/kube_manifest/spec.rb', line 103 def _ctx @_ctx end |
#_values ⇒ Object
Returns the value of attribute _values.
104 105 106 |
# File 'lib/kube_manifest/spec.rb', line 104 def _values @_values end |
Instance Method Details
#as_hash(stringify_keys = false) ⇒ Object
111 112 113 |
# File 'lib/kube_manifest/spec.rb', line 111 def as_hash(stringify_keys=false) self.class.as_hash(self, stringify_keys) end |
#as_yaml ⇒ Object
115 116 117 |
# File 'lib/kube_manifest/spec.rb', line 115 def as_yaml self.as_hash(true).to_yaml(line_width: -1) end |
#empty? ⇒ Boolean
119 120 121 122 |
# File 'lib/kube_manifest/spec.rb', line 119 def empty? specs = self.class.class_variable_get(::KubeManifest::Describe::SPEC_VAR).keys (self.instance_variables.map{|s|s.to_s.sub(/^@/, '')} & specs.map{|s|s.to_s}).empty? end |