Sha256: c344fbe505a5fefc74850101f3bbaa9171af5f61211f9d575422c97654700b4c

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

require 'front_matter_parser'


module WriteDown
  module Model

    # 基类, 定义了一些接口
    class Container

      attr_accessor :items

      def initialize(target_file, options = {})
        @target_file = target_file
        @items = []
        @options = options
      end

      def render
        template_file = File.expand_path('../../erb/container.erb', __FILE__)
        template = File.read(template_file)
        html_string = ERB.new(template).result(binding)
      end

      def build
        Layout.new(self, @target_file, @options).render
        self
      end

      def append(item)
        @items << item
        self
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
write_down-0.2.2 lib/write_down/model/container.rb
write_down-0.2.1 lib/write_down/model/container.rb
write_down-0.2.0 lib/write_down/model/container.rb