Sha256: 167d1442ab66111a2432524022dd9e8c4ea086882687e5bdfb7ca8b6fdd4fd5d

Contents?: true

Size: 479 Bytes

Versions: 3

Compression:

Stored size: 479 Bytes

Contents

# typed: false
# frozen_string_literal: true

require 'erubis'
require 'frontman/renderers/renderer'

module Frontman
  class ErbRenderer < Frontman::Renderer
    def compile(layout)
      Erubis::Eruby.new(layout, bufvar: '@_erbout')
    end

    def render_content(compiled, content, scope, data)
      data.each do |key, value|
        scope.singleton_class.send(:define_method, key) { value }
      end

      compiled.result(scope.get_binding { content })
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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