Sha256: 8e04475bcc1e7f49277f39f1e03c5c6ddeb8f77f20766d1330366fe368058a60

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

require 'frozen/template/base'
require 'frozen/environment/base'
require 'slim'

module Frozen
  module Template
    class View < Base
      attr_accessor :options
      attr_accessor :layout_path

      def initialize(options={})
      end

      def contents
        read_from_file(file_path)
      end

      def build_extension
        ".html"
      end

      def build_path
        ""
      end

      def render
        env = Frozen::Environment::Base.new(self)
        layout.render(env) { Slim::Template.new { contents }.render(env) }
      end

      def get_layout_path
        File.join(layout_path, "default.html.slim")
      end

      def layout
        Slim::Template.new {File.read(get_layout_path)}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frozen-0.0.1 lib/frozen/template/view.rb