Class: Nanoc::MutableItemCollectionView

Inherits:
MutableIdentifiableCollectionView show all
Defined in:
lib/nanoc/base/views/mutable_item_collection_view.rb

Instance Method Summary collapse

Methods inherited from MutableIdentifiableCollectionView

#delete_if

Methods inherited from IdentifiableCollectionView

#[], #each, #find_all, #initialize, #size, #unwrap

Methods inherited from View

#_context, #frozen?, #initialize, #inspect, #unwrap

Constructor Details

This class inherits a constructor from Nanoc::IdentifiableCollectionView

Instance Method Details

#create(content, attributes, identifier, binary: false, filename: nil) ⇒ self

Creates a new item and adds it to the site’s collection of items.

Parameters:

  • content (String)

    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).

  • attributes (Hash)

    A hash containing this item’s attributes.

  • identifier (Nanoc::Identifier, String)

    This item’s identifier.

  • binary (Boolean) (defaults to: false)

    Whether or not this item is binary

  • filename (String) (defaults to: nil)

    Absolute path to the file containing this content (if any)

Returns:

  • (self)


24
25
26
27
28
# File 'lib/nanoc/base/views/mutable_item_collection_view.rb', line 24

def create(content, attributes, identifier, binary: false, filename: nil)
  content = Nanoc::Int::Content.create(content, binary: binary, filename: filename)
  @objects << Nanoc::Int::Item.new(content, attributes, identifier)
  self
end

#view_classObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'lib/nanoc/base/views/mutable_item_collection_view.rb', line 4

def view_class
  Nanoc::MutableItemView
end