Sha256: 05ad05faf0244195a1dcd955ad3ab7cb307fb4ce6109451b0de9c45341209191
Contents?: true
Size: 926 Bytes
Versions: 18
Compression:
Stored size: 926 Bytes
Contents
class KuberKit::TemplateReader::Reader ReaderNotFoundError = Class.new(KuberKit::NotFoundError) include KuberKit::Import[ "template_reader.artifact_file_reader", ] def use_reader(template_reader, template_class:) @@readers ||= {} if !template_reader.is_a?(KuberKit::TemplateReader::AbstractTemplateReader) raise ArgumentError.new("should be an instance of KuberKit::TemplateReader::AbstractTemplateReader, got: #{template_reader.inspect}") end @@readers[template_class] = template_reader end def read(shell, template) add_default_readers reader = @@readers[template.class] raise ReaderNotFoundError, "Can't find reader for template #{template}" if reader.nil? reader.read(shell, template) end def add_default_readers use_reader(artifact_file_reader, template_class: KuberKit::Core::Templates::ArtifactFile) end def reset! @@readers = {} end end
Version data entries
18 entries across 18 versions & 1 rubygems