class Jekyll::Draft

Constants

MATCHER

Valid post name regex (no date)

Public Class Methods

valid?(name) click to toggle source

Draft name validator. Draft filenames must be like: my-awesome-post.textile

Returns true if valid, false if not.

# File lib/jekyll/draft.rb, line 12
def self.valid?(name)
  name =~ MATCHER
end

Public Instance Methods

containing_dir(dir) click to toggle source

Get the full path to the directory containing the draft files

# File lib/jekyll/draft.rb, line 17
def containing_dir(dir)
  site.in_source_dir(dir, '_drafts')
end
process(name) click to toggle source

Extract information from the post filename.

name - The String filename of the post file.

Returns nothing.

# File lib/jekyll/draft.rb, line 31
def process(name)
  m, slug, ext = *name.match(MATCHER)
  self.date = File.mtime(File.join(@base, name))
  self.slug = slug
  self.ext = ext
end
relative_path() click to toggle source

The path to the draft source file, relative to the site source

# File lib/jekyll/draft.rb, line 22
def relative_path
  File.join(@dir, '_drafts', @name)
end