Class: Bridgetown::LayoutReader
- Inherits:
-
Object
- Object
- Bridgetown::LayoutReader
- Defined in:
- bridgetown-core/lib/bridgetown-core/readers/layout_reader.rb
Instance Attribute Summary collapse
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
-
#initialize(site) ⇒ LayoutReader
constructor
A new instance of LayoutReader.
-
#layout_directory ⇒ Object
-
#read ⇒ Object
Constructor Details
#initialize(site) ⇒ LayoutReader
Returns a new instance of LayoutReader.
7 8 9 10 |
# File 'bridgetown-core/lib/bridgetown-core/readers/layout_reader.rb', line 7 def initialize(site) @site = site @layouts = HashWithDotAccess::Hash.new end |
Instance Attribute Details
#site ⇒ Object (readonly)
Returns the value of attribute site.
5 6 7 |
# File 'bridgetown-core/lib/bridgetown-core/readers/layout_reader.rb', line 5 def site @site end |
Instance Method Details
#layout_directory ⇒ Object
28 29 30 |
# File 'bridgetown-core/lib/bridgetown-core/readers/layout_reader.rb', line 28 def layout_directory @layout_directory ||= site.in_source_dir(site.config["layouts_dir"]) end |
#read ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'bridgetown-core/lib/bridgetown-core/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 site.config.source_manifests.filter_map(&:layouts).each do |plugin_layouts| layout_entries(plugin_layouts).each do |layout_file| @layouts[layout_name(layout_file)] ||= Layout.new(site, plugin_layouts, layout_file, from_plugin: true) end end @layouts end |