Class: Jekyll::LayoutReader

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/readers/layout_reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site) ⇒ LayoutReader

Returns a new instance of LayoutReader.


7
8
9
10
# File 'lib/jekyll/readers/layout_reader.rb', line 7

def initialize(site)
  @site = site
  @layouts = {}
end

Instance Attribute Details

#siteObject (readonly)

Returns the value of attribute site


5
6
7
# File 'lib/jekyll/readers/layout_reader.rb', line 5

def site
  @site
end

Instance Method Details

#layout_directoryObject


26
27
28
# File 'lib/jekyll/readers/layout_reader.rb', line 26

def layout_directory
  @layout_directory ||= site.in_source_dir(site.config["layouts_dir"])
end

#readObject


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jekyll/readers/layout_reader.rb', line 12

def read
  layout_entries.each do |layout_file|
    @layouts[layout_name(layout_file)] = \
      Layout.new(site, layout_directory, layout_file)
  end

  theme_layout_entries.each do |layout_file|
    @layouts[layout_name(layout_file)] ||= \
      Layout.new(site, theme_layout_directory, layout_file)
  end

  @layouts
end

#theme_layout_directoryObject


30
31
32
# File 'lib/jekyll/readers/layout_reader.rb', line 30

def theme_layout_directory
  @theme_layout_directory ||= site.theme.layouts_path if site.theme
end