Sha256: 6564c97160268a5cf8ddc67a4b0b0293703f9ac963a0177ca863a6801631750e

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module Jekyll

  class Layout
    include Convertible

    # Gets the Site object.
    attr_reader :site

    # Gets/Sets the extension of this layout.
    attr_accessor :ext

    # Gets/Sets the Hash that holds the metadata for this layout.
    attr_accessor :data

    # Gets/Sets the content of this layout.
    attr_accessor :content

    # 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

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

    # The source filename for this layout.
    def filename
      File.join(@base, @name)
    end

    def inspect
      "<Layout: @name=#{@name.inspect}>"
    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
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll-reloaded-0.12.2 lib/jekyll/layout.rb
jekyll-reloaded-0.12.1 lib/jekyll/layout.rb
jekyll-reloaded-0.12 lib/jekyll/layout.rb