Class: Webby::Resources::Layout
- Defined in:
- lib/webby/resources/layout.rb
Overview
A Layout is any file that is found in the layout folder of the webiste directory. Layouts container the common elements of all the pages in a website, and pages from the content folder are rendered into the layout.
Instance Attribute Summary
Attributes inherited from Resource
#dir, #ext, #filename, #mtime, #path
Instance Method Summary collapse
-
#destination ⇒ Object
call-seq: destination => string.
-
#extension ⇒ Object
call-seq: extension => string or nil.
-
#initialize(fn) ⇒ Layout
constructor
call-seq: Layout.new( path ).
-
#url ⇒ Object
call-seq: url => nil.
Methods inherited from Resource
#<=>, #[], #[]=, #dirty?, #equal?, #method_missing
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Webby::Resources::Resource
Instance Method Details
#destination ⇒ Object
call-seq:
destination => string
The output file destination for the layout. This is the “.cairn” file in the output folder. It is used to determine if the layout is newer than the build products.
31 32 33 |
# File 'lib/webby/resources/layout.rb', line 31 def destination ::Webby.cairn end |
#extension ⇒ Object
call-seq:
extension => string or nil
Returns the extension to be applied to output files rendered by the layotut. This will either be a string or nil
if the layout does not specify an extension to use.
42 43 44 45 46 47 48 49 |
# File 'lib/webby/resources/layout.rb', line 42 def extension return @mdata['extension'] if @mdata.has_key? 'extension' if @mdata.has_key? 'layout' lyt = ::Webby::Resources.find_layout(@mdata['layout']) ext = lyt ? lyt.extension : nil end end |
#url ⇒ Object
call-seq:
url => nil
Layouts do not have a URL. This method will alwasy return nil
.
56 57 58 |
# File 'lib/webby/resources/layout.rb', line 56 def url nil end |