Class | Nanoc3::Item |
In: |
lib/nanoc3/base/item.rb
|
Parent: | Object |
Represents a compileable item in a site. It has content and attributes, as well as an identifier (which starts and ends with a slash). It can also store the modification time to speed up compilation.
outdated_due_to_dependencies | -> | outdated_due_to_dependencies? |
attributes | [RW] | @return [Hash] This item‘s attributes |
children | [RW] | @return [Array<Nanoc3::Item>] The child items of this item |
identifier | [RW] | @return [String] This item‘s identifier |
mtime | [R] | @return [Time] The time when this item was last modified |
outdated_due_to_dependencies | [RW] | @return [Boolean] Whether or not this item is outdated because of its dependencies are outdated |
parent | [RW] | @return [Nanoc3::Item, nil] The parent item of this item. This can be nil even for non-root items. |
raw_content | [R] | @return [String] This item‘s raw, uncompiled content of this item (only available for textual items) |
raw_filename | [R] | @return [String] The filename pointing to the file containing this item’s content (only available for binary items) |
reps | [R] | @return [Array<Nanoc3::ItemRep>] This item’s list of item reps |
site | [RW] | @return [Nanoc3::Site] The site this item belongs to |
Creates a new item with the given content or filename, attributes and identifier.
Note that the API in 3.1 has changed a bit since 3.0; the API remains backwards compatible, however. Passing the modification time as the 4th parameter is deprecated; pass it as the `:mtime` method option instead.
@param [String] raw_content_or_raw_filename 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 [String] identifier This item‘s identifier.
@param [Time, Hash, nil] params_or_mtime Extra parameters for the item, or the time when this item was last modified (deprecated).
@option params_or_mtime [Time, nil] :mtime (nil) The time when this item was last modified
@option params_or_mtime [Symbol, nil] :binary (true) Whether or not this item is binary
Requests the attribute with the given key.
@param [Symbol] key The name of the attribute to fetch
@return [Object] The value of the requested attribute
Sets the attribute with the given key to the given value.
@param [Symbol] key The name of the attribute to set
@param [Object] value The value of the attribute to set
Returns the compiled content from a given representation and a given snapshot. This is a convenience method that makes fetching compiled content easier.
@option params [String] :rep (:default) The name of the representation from which the compiled content should be fetched. By default, the compiled content will be fetched from the default representation.
@option params [String] :snapshot The name of the snapshot from which to fetch the compiled content. By default, the returned compiled content will be the content compiled right before the first layout call (if any).
@return [String] The compiled content of the given rep (or the default rep if no rep is specified) at the given snapshot (or the default snapshot if no snapshot is specified)
Determines whether this item (or rather, its reps) is outdated and should be recompiled (or rather, its reps should be recompiled).
@return [Boolean] true if any reps are outdated; false otherwise.
Returns the path from a given representation. This is a convenience method that makes fetching the path of a rep easier.
@option params [String] :rep (:default) The name of the representation from which the path should be fetched. By default, the path will be fetched from the default representation.
@return [String] The path of the given rep ( or the default rep if no rep is specified)
Returns the rep with the given name.
@param [Symbol] rep_name The name of the representation to return
@return [Nanoc3::ItemRep] The representation with the given name