Sha256: 1c6dc0f2602c1cda1ea8c9d429c278c9aba848ebab07fdd11808440fa5a28001

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

require 'malt/engines/abstract'

module Malt::Engine

  # Mustache engine.
  #
  #   http://github.com/defunkt/mustache
  #
  class Mustache < Abstract

    register :mustache

    ## Convert Markdown text to intermediate object.
    #def intermediate(params)
    #  text = params[:text]
    #  ???
    #end

    #
    def render(params={}, &yld) #file, db, &yld)
      text = params[:text]
      data = params[:data]

      data = make_hash(data, &yld)

      #engine = intermediate(params)
      #engine.render(data)
      ::Mustache.render(text, data)
    end


    private

    # Load rdoc makup library if not already loaded.
    def initialize_engine
      return if defined? ::Mustache
      require_library 'mustache'
    end

  end

end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
malt-0.3.0 lib/malt/engines/mustache.rb
malt-0.2.0 lib/malt/engines/mustache.rb