Class Webby::Resources::Resource
In: lib/webby/resources/resource.rb
Parent: Object

A Webby::Resource is any file that can be found in the content directory or in the layout directory. This class contains information about the resources available to Webby.

Methods

<=>   ==   []   []=   destination   directory   dirty?   eql?   equal?   extension   filename   method_missing   new   url  

Attributes

dir  [R]  The directory of the resource excluding the content directory
ext  [R]  Extesion of the resource file
mtime  [R]  Resource file modification time
name  [R]  The name of the file excluding the directory and extension
path  [R]  The full path to the resource file

Public Class methods

Creates a new resource object given the filename.

Public Instance methods

Resource comparison operates on the full path of the resource objects and uses the standard String comparison operator. Returns nil if other is not a Resource instance.

==( other )

Alias for equal?

Returns the value associated with the given meta-data key. Key is converted into a string.

Sets the given meta-data key to the value. Key is converted into a string.

Returns the path in the output directory where the resource will be generated. This path is used to determine if the resource is dirty and in need of generating.

The location of this resource in the directory structure. This directory does not include the content folder or the output folder.

Returns true if this resource is newer than its corresponding output product. The resource needs to be rendered (if a page or layout) or copied (if a static file) to the output directory.

eql?( other )

Alias for equal?

Returns true if the path of this resource is equivalent to the path of the other resource. Returns false if this is not the case.

The resource file extension. This will either be the extension of the file or the ‘extension’ attribute from the meta-data if present.

The resource filename excluding path and extension. This will either be the name of the file or the ‘filename’ attribute from the meta-data if present.

Invoked by Ruby when a message is sent to the resource that it cannot handle. The default behavior is to convert symbol to a string and search for that string in the resource‘s meta-data. If found, the meta-data item is returned; otherwise, nil is returned.

Returns a string suitable for use as a URL linking to this resource.

[Validate]