Sha256: b462a972a328eeb118468d24a04b8fc56254e993900472e9fcfb2f9c2e5e8152

Contents?: true

Size: 875 Bytes

Versions: 3

Compression:

Stored size: 875 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_variables.include?('@_extensions')
      extensions.empty? ? self._extensions || [] : self._extensions = (self._extensions || []) + extensions
    end

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-2.0.4 lib/nanoc/base/layout_processor.rb
nanoc-2.0.2 lib/nanoc/base/layout_processor.rb
nanoc-2.0.3 lib/nanoc/base/layout_processor.rb