Sha256: c897ecaa68f8081b0a99b37638e78a24142168fffe5ec7743ea3e389657eb32c

Contents?: true

Size: 871 Bytes

Versions: 2

Compression:

Stored size: 871 Bytes

Contents

module Nanoc
  class LayoutProcessor < Plugin

    def initialize(page, pages, config, site, other_assigns={})
      @page          = page
      @pages         = pages
      @config        = config
      @site          = site
      @other_assigns = other_assigns
    end

    def run(layout)
      error 'LayoutProcessor#run must be overridden'
    end

    # Extensions

    class << self
      attr_accessor :_extensions
    end

    def self.extensions(*extensions)
      self._extensions = [] unless instance_variable_defined?(:@_extensions)
      extensions.empty? ? self._extensions || [] : self._extensions = (self._extensions || []) + extensions
    end

    def self.extension(extension=nil)
      self._extensions = [] unless instance_variable_defined?(:@_extensions)
      extension.nil? ? self.extensions.first : self.extensions(extension)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-2.0 lib/nanoc/base/layout_processor.rb
nanoc-2.0.1 lib/nanoc/base/layout_processor.rb