Sha256: 7cdbd57da87781e7ebd4a7ceb8cdaba1adab9f09f2ee76d187724cc97a05da73

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8

module Nanoc
  class MutableItemCollectionView < Nanoc::ItemCollectionView
    # @api private
    def view_class
      Nanoc::MutableItemView
    end

    # Creates a new item and adds it to the site’s collection of items.
    #
    # @param [String] content The uncompiled item content (if it is a textual
    #   item) or the path to the filename containing the content (if it is a
    #   binary item).
    #
    # @param [Hash] attributes A hash containing this item's attributes.
    #
    # @param [Nanoc::Identifier, String] identifier This item's identifier.
    #
    # @param [Hash] params Extra parameters.
    #
    # @option params [Symbol, nil] :binary (true) Whether or not this item is
    #   binary
    #
    # @return [self]
    def create(content, attributes, identifier, params = {})
      @items << Nanoc::Int::Item.new(content, attributes, identifier, params)
      self
    end

    # Deletes every item for which the block evaluates to true.
    #
    # @yieldparam [Nanoc::ItemView] item
    #
    # @yieldreturn [Boolean]
    #
    # @return [self]
    def delete_if(&block)
      @items.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_item_collection.rb
nanoc-4.0.0a2 lib/nanoc/base/views/mutable_item_collection.rb