Sha256: 81640fcdf053cfb32d784e54c483ea625f465b4a1b8281a4f44fede6aa2c5f14

Contents?: true

Size: 673 Bytes

Versions: 5

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

module Metatron
  # Base class for templating Kubernetes resources
  class Template
    attr_accessor :api_version, :label_namespace, :name
    attr_reader :kind

    def initialize(name)
      @name = name
      @label_namespace = "metatron.therubyist.org"
      @api_version = "v1"
      run_initializers
    end

    alias apiVersion api_version

    def self.initializer(*args)
      @initializers ||= []
      @initializers += args
    end

    def self.initializers
      @initializers ||= []
    end

    private

    def run_initializers
      self.class.initializers.each { |initializer| send(initializer.to_sym) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
metatron-0.1.4 lib/metatron/template.rb
metatron-0.1.3 lib/metatron/template.rb
metatron-0.1.2 lib/metatron/template.rb
metatron-0.1.1 lib/metatron/template.rb
metatron-0.1.0 lib/metatron/template.rb