Sha256: d9d02de5f0288a8265ee3e4ae535447c85c403c78f6cc2a95aa7910ed3c2703e

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 Bytes

Contents

# typed: true
# frozen_string_literal: true

require 'frontman/renderers/erb_renderer'
require 'frontman/renderers/haml_renderer'
require 'frontman/renderers/markdown_renderer'
require 'singleton'
require 'sorbet-runtime'

module Frontman
  class RendererResolver
    extend T::Sig
    include Singleton

    sig { params(extension: String).returns(T.nilable(Frontman::Renderer)) }
    def get_renderer(extension)
      renderers = {
        'erb': Frontman::ErbRenderer.instance,
        'md': Frontman::MarkdownRenderer.instance,
        'haml': Frontman::HamlRenderer.instance
      }

      renderers[extension.to_sym]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
frontman-ssg-0.0.4 lib/frontman/renderers/renderer_resolver.rb
frontman-ssg-0.0.3 lib/frontman/renderers/renderer_resolver.rb
frontman-ssg-0.0.2 lib/frontman/renderers/renderer_resolver.rb