Class: NetworkPolicy::NetworkPolicyPeer::NamespaceSelector

Inherits:
NetworkPolicy::NetworkPolicyPeer show all
Defined in:
lib/xlsx_to_k8s_network_policy.rb

Overview

A {…} NetworkPolicyPeer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label_selector = nil) ⇒ NamespaceSelector

Returns a new instance of NamespaceSelector.



110
111
112
# File 'lib/xlsx_to_k8s_network_policy.rb', line 110

def initialize(label_selector = nil)
  @label_selector = label_selector || LabelSelector::MatchLabels.new
end

Instance Attribute Details

#label_selectorObject (readonly)

Returns the value of attribute label_selector.



109
110
111
# File 'lib/xlsx_to_k8s_network_policy.rb', line 109

def label_selector
  @label_selector
end

Instance Method Details

#==(other) ⇒ Object



124
125
126
# File 'lib/xlsx_to_k8s_network_policy.rb', line 124

def ==(other)
  other.class == self.class && other.label_selector == label_selector
end

#[]=(key, value) ⇒ Object



114
115
116
# File 'lib/xlsx_to_k8s_network_policy.rb', line 114

def []=(key, value)
  @label_selector[key] = value
end

#as_hashObject



118
119
120
121
122
# File 'lib/xlsx_to_k8s_network_policy.rb', line 118

def as_hash
  {
    labelSelector: @label_selector.as_hash
  }
end