Class: WriteDown::Model::Essay

Inherits:
Base
  • Object
show all
Defined in:
lib/write_down/model/essay.rb

Overview

代表散文

Instance Attribute Summary

Attributes inherited from Base

#content, #created_at, #draft, #link_to

Instance Method Summary collapse

Methods inherited from Base

#body, #converter, #initialize, #read_from_head

Constructor Details

This class inherits a constructor from WriteDown::Model::Base

Instance Method Details

#buildObject



19
20
21
22
# File 'lib/write_down/model/essay.rb', line 19

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

#renderObject



12
13
14
15
16
17
# File 'lib/write_down/model/essay.rb', line 12

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

#summaryObject

概览



25
26
27
# File 'lib/write_down/model/essay.rb', line 25

def summary
  @meta['summary']
end

#titleObject

标题



30
31
32
# File 'lib/write_down/model/essay.rb', line 30

def title
  @meta['title']
end