Sha256: 73760982a075041011ab4f6ec9ac720f658a94d0e92d1f02ff9ef7bb4aad07d8

Contents?: true

Size: 911 Bytes

Versions: 2

Compression:

Stored size: 911 Bytes

Contents

# encoding: utf-8

module Nanoc
  class MutableLayoutCollectionView < Nanoc::LayoutCollectionView
    # @api private
    def view_class
      Nanoc::MutableLayoutView
    end

    # Creates a new layout and adds it to the site’s collection of layouts.
    #
    # @param [String] content The layout content.
    #
    # @param [Hash] attributes A hash containing this layout's attributes.
    #
    # @param [Nanoc::Identifier, String] identifier This layout's identifier.
    #
    # @return [self]
    def create(content, attributes, identifier)
      @layouts << Nanoc::Int::Layout.new(content, attributes, identifier)
      self
    end

    # Deletes every layout for which the block evaluates to true.
    #
    # @yieldparam [Nanoc::LayoutView] layout
    #
    # @yieldreturn [Boolean]
    #
    # @return [self]
    def delete_if(&block)
      @layouts.delete_if(&block)
      self
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-4.0.0b1 lib/nanoc/base/views/mutable_layout_collection.rb
nanoc-4.0.0a2 lib/nanoc/base/views/mutable_layout_collection.rb