Class: Frontman::RendererResolver

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Singleton
Defined in:
lib/frontman/renderers/renderer_resolver.rb

Instance Method Summary collapse

Instance Method Details

#all_renderersObject



23
24
25
26
27
28
29
30
# File 'lib/frontman/renderers/renderer_resolver.rb', line 23

def all_renderers
  @all_renderers ||= {
    erb: Frontman::ErbRenderer.instance,
    md: Frontman::MarkdownRenderer.instance,
    haml: Frontman::HamlRenderer.instance,
    slim: Frontman::SlimRenderer.instance
  }
end

#get_renderer(extension) ⇒ Object



18
19
20
# File 'lib/frontman/renderers/renderer_resolver.rb', line 18

def get_renderer(extension)
  all_renderers[extension.to_sym]
end

#valid_extension?(extension) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
36
37
# File 'lib/frontman/renderers/renderer_resolver.rb', line 33

def valid_extension?(extension)
  # We have to append html and txt manually here
  # so we can extract front matter data from them
  all_renderers.keys.push(:html, :txt).include?(extension.to_sym)
end