diff options
| author | Benjamin Sanders <ben@Benjamins-MacBook-Pro.local> | 2025-10-11 10:34:24 -0400 |
|---|---|---|
| committer | Benjamin Sanders <ben@Benjamins-MacBook-Pro.local> | 2025-10-11 10:34:24 -0400 |
| commit | 5571dc766e2143e39762ff0b47c41d1c2e154f4c (patch) | |
| tree | f4f124d314a7e76c04484515aa0fd1f2e271a601 /vendor/bundle/ruby/3.4.0/gems/jekyll-4.4.1/lib/jekyll/layout.rb | |
| parent | 359f3309c97fc894b63e0a295c76ab298504d635 (diff) | |
Vendor bundled gems for deployment
Diffstat (limited to 'vendor/bundle/ruby/3.4.0/gems/jekyll-4.4.1/lib/jekyll/layout.rb')
| -rw-r--r-- | vendor/bundle/ruby/3.4.0/gems/jekyll-4.4.1/lib/jekyll/layout.rb | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/vendor/bundle/ruby/3.4.0/gems/jekyll-4.4.1/lib/jekyll/layout.rb b/vendor/bundle/ruby/3.4.0/gems/jekyll-4.4.1/lib/jekyll/layout.rb new file mode 100644 index 0000000..af3ea71 --- /dev/null +++ b/vendor/bundle/ruby/3.4.0/gems/jekyll-4.4.1/lib/jekyll/layout.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module Jekyll + class Layout + include Convertible + + attr_accessor :content, # content of layout + :data, # the Hash that holds the metadata for this layout + :ext # extension of layout + + attr_reader :name, # name of layout + :path, # path to layout + :site, # the Site object + :relative_path # path to layout relative to its base + + # Initialize a new Layout. + # + # site - The Site. + # base - The String path to the source. + # name - The String filename of the post file. + 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 + + # Extract information from the layout filename. + # + # name - The String filename of the layout file. + # + # Returns nothing. + def process(name) + self.ext = File.extname(name) + end + + # Returns the object as a debug String. + def inspect + "#<#{self.class} @path=#{@path.inspect}>" + end + end +end |
