Class: Jekyll::Layout
- Inherits:
-
Object
- Object
- Jekyll::Layout
- Includes:
- Convertible
- Defined in:
- lib/jekyll/layout.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Gets/Sets the content of this layout.
-
#data ⇒ Object
Gets/Sets the Hash that holds the metadata for this layout.
-
#ext ⇒ Object
Gets/Sets the extension of this layout.
-
#name ⇒ Object
readonly
Gets the name of this layout.
-
#path ⇒ Object
readonly
Gets the path to this layout.
-
#site ⇒ Object
readonly
Gets the Site object.
Instance Method Summary collapse
-
#initialize(site, base, name) ⇒ Layout
constructor
Initialize a new Layout.
-
#process(name) ⇒ Object
Extract information from the layout filename.
Methods included from Convertible
#[], #asset_file?, #coffeescript_file?, #converters, #do_layout, #hook_owner, #invalid_layout?, #output_ext, #place_in_layout?, #published?, #read_yaml, #render_all_layouts, #render_liquid, #render_with_liquid?, #sass_file?, #to_liquid, #to_s, #transform, #type, #validate_data!, #validate_permalink!, #write
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.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jekyll/layout.rb', line 28 def initialize(site, base, name) @site = site @base = base @name = name @path = site.in_source_dir(base, name) self.data = {} process(name) read_yaml(base, name) end |
Instance Attribute Details
#content ⇒ Object
Gets/Sets the content of this layout.
21 22 23 |
# File 'lib/jekyll/layout.rb', line 21 def content @content end |
#data ⇒ Object
Gets/Sets the Hash that holds the metadata for this layout.
18 19 20 |
# File 'lib/jekyll/layout.rb', line 18 def data @data end |
#ext ⇒ Object
Gets/Sets the extension of this layout.
15 16 17 |
# File 'lib/jekyll/layout.rb', line 15 def ext @ext end |
#name ⇒ Object (readonly)
Gets the name of this layout.
9 10 11 |
# File 'lib/jekyll/layout.rb', line 9 def name @name end |
#path ⇒ Object (readonly)
Gets the path to this layout.
12 13 14 |
# File 'lib/jekyll/layout.rb', line 12 def path @path end |
#site ⇒ Object (readonly)
Gets the Site object.
6 7 8 |
# File 'lib/jekyll/layout.rb', line 6 def site @site end |
Instance Method Details
#process(name) ⇒ Object
Extract information from the layout filename.
name - The String filename of the layout file.
Returns nothing.
45 46 47 |
# File 'lib/jekyll/layout.rb', line 45 def process(name) self.ext = File.extname(name) end |