Sha256: 228d9594e424eb51152a64d159bb9b44f3cc2b4f4b4ae410248bab129819fe56

Contents?: true

Size: 821 Bytes

Versions: 3

Compression:

Stored size: 821 Bytes

Contents

# coding: utf-8

module Retter
  module Page
    class Entry
      class ViewContext < Base::ViewContext
        attr_reader :entry

        def initialize(entry)
          @entry = entry
        end
      end

      include Base

      attr_reader :entry

      def initialize(entry)
        super()

        @path_prefix = '../'
        @entry       = entry
        @title       = "#{entry.date} - #{config.title}"
      end

      def path
        Page.entry_file(entry.date)
      end

      def template_path
        Page.find_template_path('entry')
      end

      def bind
        context = ViewContext.new(entry)
        part    = Tilt.new(
          template_path.to_path,
          ugly: true,
          filename: template_path.to_path
        ).render(context)

        print part
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
retter-0.2.5 lib/retter/page/entry.rb
retter-0.2.4 lib/retter/page/entry.rb
retter-0.2.3 lib/retter/page/entry.rb