Class: Wright::Util::MustacheRenderer Private

Inherits:
Object
  • Object
show all
Defined in:
lib/wright/util/mustache_renderer.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Mustache renderer.

Examples:

template = "foo is {{foo}}."
hash = { foo: :bar }
Wright::Util::MustacheRenderer.new(hash).render(template)
# => "foo is bar."

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ MustacheRenderer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MustacheRenderer.



18
19
20
21
# File 'lib/wright/util/mustache_renderer.rb', line 18

def initialize(hash)
  @hash = hash
  @mustache = select_mustache
end

Instance Method Details

#render(template) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Renders a Mustache template.

Parameters:

  • template (String)

    the template

Returns:

  • (String)

    the rendered template



26
27
28
# File 'lib/wright/util/mustache_renderer.rb', line 26

def render(template)
  @mustache.render(template, @hash)
end