Class: Hikkoshi::Jekyll::Post

Inherits:
Post
  • Object
show all
Includes:
Hikkoshi::Jekyll::PostProcessor::Slug, Support::TimeParser
Defined in:
lib/hikkoshi/jekyll/post.rb

Constant Summary collapse

SEPARATOR =
/---\r?\n/

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ Post

Returns a new instance of Post.



12
13
14
15
16
17
18
19
20
# File 'lib/hikkoshi/jekyll/post.rb', line 12

def initialize(filename)
  super()

  @filename = filename
  @original_metadata, @content = load_file(@filename)

  
  post_process
end

Instance Method Details

#categories=(categories) ⇒ Object



39
40
41
# File 'lib/hikkoshi/jekyll/post.rb', line 39

def categories=(categories)
  @categories += categories if categories.is_a? Array
end

#category=(category) ⇒ Object



43
44
45
# File 'lib/hikkoshi/jekyll/post.rb', line 43

def category=(category)
  @categories << category
end

#date=(date) ⇒ Object



35
36
37
# File 'lib/hikkoshi/jekyll/post.rb', line 35

def date=(date)
  @published_at = parse_time(date)
end

#published=(published) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/hikkoshi/jekyll/post.rb', line 26

def published=(published)
  if published == false
    @status = "draft"
  else
    # by default it is published
    @status = "published"
  end
end

#slug=(slug) ⇒ Object



22
23
24
# File 'lib/hikkoshi/jekyll/post.rb', line 22

def slug=(slug)
  @slug = slug
end

#tags=(tags) ⇒ Object



47
48
49
# File 'lib/hikkoshi/jekyll/post.rb', line 47

def tags=(tags)
  @tags += tags if tags.is_a? Array
end