Class: KubeDSL::SerializeHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/kube-dsl/serialize_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, version, kind, field, &block) ⇒ SerializeHandler

Returns a new instance of SerializeHandler.



7
8
9
10
11
12
13
# File 'lib/kube-dsl/serialize_handler.rb', line 7

def initialize(namespace, version, kind, field, &block)
  @namespace = namespace
  @version = version
  @kind = kind
  @field = field
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



5
6
7
# File 'lib/kube-dsl/serialize_handler.rb', line 5

def block
  @block
end

#fieldObject (readonly)

Returns the value of attribute field.



5
6
7
# File 'lib/kube-dsl/serialize_handler.rb', line 5

def field
  @field
end

#kindObject (readonly)

Returns the value of attribute kind.



5
6
7
# File 'lib/kube-dsl/serialize_handler.rb', line 5

def kind
  @kind
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



5
6
7
# File 'lib/kube-dsl/serialize_handler.rb', line 5

def namespace
  @namespace
end

#versionObject (readonly)

Returns the value of attribute version.



5
6
7
# File 'lib/kube-dsl/serialize_handler.rb', line 5

def version
  @version
end

Instance Method Details

#handle(res, inflector) ⇒ Object



22
23
24
# File 'lib/kube-dsl/serialize_handler.rb', line 22

def handle(res, inflector)
  block.call(res, inflector)
end

#matches?(ref, field) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
# File 'lib/kube-dsl/serialize_handler.rb', line 15

def matches?(ref, field)
  ref.namespace == namespace &&
    ref.version == version &&
    ref.kind == kind &&
    field == self.field
end