Sha256: 2177e96c96a876deaf360e62533d625a797fe0624aaf7a7906ae000dcc507319

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

module Mako
  class HTMLRenderer
    include FileOpenUtil

    attr_reader :template, :bound, :feed_template

    def initialize(args)
      @template = args.fetch(:template, File.expand_path(File.join('themes', "#{Mako.config.theme}.html.erb"), Dir.pwd))
      @bound = args.fetch(:bound)
      @feed_template = File.expand_path('../layouts/_feed_container.html.erb', __FILE__)
    end

    # Wrapper for ERB renderer. Creates new ERB instance with view template
    # and renders it with binding from core.
    #
    # @return [String]
    def render
      ERB.new(load_resource(template)).result(bound.get_binding)
    end

    # Default file name for rendererd file.
    #
    # @return [String]
    def file_path
      'index.html'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mako_rss-0.2.3 lib/mako/html_renderer.rb
mako_rss-0.2.2 lib/mako/html_renderer.rb
mako_rss-0.2.1 lib/mako/html_renderer.rb
mako_rss-0.2.0 lib/mako/html_renderer.rb
mako_rss-0.1.0 lib/mako/html_renderer.rb