Class: Jekyll::Layout

Inherits:
Object
  • Object
show all
Includes:
Convertible
Defined in:
lib/jekyll/layout.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Convertible

#converter, #do_layout, #output_ext, #read_yaml, #to_s, #transform

Constructor Details

#initialize(site, base, name) ⇒ Layout

Initialize a new Layout.

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



23
24
25
26
27
28
29
30
# File 'lib/jekyll/layout.rb', line 23

def initialize(site, base, name)
  @site = site
  @base = base
  @name = name

  self.process(name)
  self.read_yaml(base, name)
end

Instance Attribute Details

#contentObject

Gets/Sets the content of this layout.



16
17
18
# File 'lib/jekyll/layout.rb', line 16

def content
  @content
end

#dataObject

Gets/Sets the Hash that holds the metadata for this layout.



13
14
15
# File 'lib/jekyll/layout.rb', line 13

def data
  @data
end

#extObject

Gets/Sets the extension of this layout.



10
11
12
# File 'lib/jekyll/layout.rb', line 10

def ext
  @ext
end

#siteObject (readonly)

Gets the Site object.



7
8
9
# File 'lib/jekyll/layout.rb', line 7

def site
  @site
end

Instance Method Details

#filenameObject

The source filename for this layout.



33
34
35
# File 'lib/jekyll/layout.rb', line 33

def filename
  File.join(@base, @name)
end

#inspectObject



37
38
39
# File 'lib/jekyll/layout.rb', line 37

def inspect
  "<Layout: @name=#{@name.inspect}>"
end

#process(name) ⇒ Object

Extract information from the layout filename.

name - The String filename of the layout file.

Returns nothing.



46
47
48
# File 'lib/jekyll/layout.rb', line 46

def process(name)
  self.ext = File.extname(name)
end