class Jekyll::Layout

Attributes

content[RW]
data[RW]
ext[RW]
name[R]
path[R]
relative_path[R]
site[R]

Public Class Methods

new(site, base, name) click to toggle source

Initialize a new Layout.

site - The Site. base - The String path to the source. name - The String filename of the post file.

# File lib/jekyll/layout.rb, line 21
def initialize(site, base, name)
  @site = site
  @base = base
  @name = name

  if site.theme && site.theme.layouts_path.eql?(base)
    @base_dir = site.theme.root
    @path = site.in_theme_dir(base, name)
  else
    @base_dir = site.source
    @path = site.in_source_dir(base, name)
  end
  @relative_path = @path.sub(@base_dir, "")

  self.data = {}

  process(name)
  read_yaml(base, name)
end

Public Instance Methods

inspect() click to toggle source

Returns the object as a debug String.

# File lib/jekyll/layout.rb, line 51
def inspect
  "#<#{self.class} @path=#{@path.inspect}>"
end
process(name) click to toggle source

Extract information from the layout filename.

name - The String filename of the layout file.

Returns nothing.

# File lib/jekyll/layout.rb, line 46
def process(name)
  self.ext = File.extname(name)
end