Sha256: c55d0c2ebe3d01f633a5ebc0f0effc074b72b1b72d8d03107fdbf17beaec1f85
Contents?: true
Size: 1006 Bytes
Versions: 40
Compression:
Stored size: 1006 Bytes
Contents
class KuberKit::TemplateReader::Reader ReaderNotFoundError = Class.new(KuberKit::NotFoundError) include KuberKit::Import[ "template_reader.strategies.artifact_file", ] def initialize(**injected_deps) super(injected_deps) add_default_strategies end def use_reader(template_reader, template_class:) @@readers ||= {} if !template_reader.is_a?(KuberKit::TemplateReader::Strategies::Abstract) raise ArgumentError.new("should be an instance of KuberKit::TemplateReader::Strategies::Abstract, got: #{template_reader.inspect}") end @@readers[template_class] = template_reader end def read(shell, template) reader = @@readers[template.class] raise ReaderNotFoundError, "Can't find reader for template #{template}" if reader.nil? reader.read(shell, template) end def reset! @@readers = {} end private def add_default_strategies use_reader(artifact_file, template_class: KuberKit::Core::Templates::ArtifactFile) end end
Version data entries
40 entries across 40 versions & 1 rubygems