Class: Webby::Resources::Static
- Defined in:
- lib/webby/resources/static.rb
Overview
A Static resource is any file in the content folder that does not contain YAML meta-data at the top of the file and does not start with and underscore “_” character (those are partials). Static resources will be copied as-is from the content directory to the output directory.
Instance Attribute Summary
Attributes inherited from Resource
#_meta_data, #dir, #ext, #mtime, #name, #path
Instance Method Summary collapse
-
#_read ⇒ Object
:stopdoc:.
-
#dirty? ⇒ Boolean
Returns
true
if this static file is newer than its corresponding output product. -
#render ⇒ Object
Returns the contents of the file.
Methods inherited from Resource
#<=>, #[], #[]=, #_reset, #destination, #directory, #equal?, #extension, #filename, #initialize, #method_missing, #url
Constructor Details
This class inherits a constructor from Webby::Resources::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Webby::Resources::Resource
Instance Method Details
#_read ⇒ Object
:stopdoc:
28 29 30 |
# File 'lib/webby/resources/static.rb', line 28 def _read ::File.read(path) end |
#dirty? ⇒ Boolean
Returns true
if this static file is newer than its corresponding output product. The static file needs to be copied to the output directory.
22 23 24 25 |
# File 'lib/webby/resources/static.rb', line 22 def dirty? return true unless test(?e, destination) @mtime > ::File.mtime(destination) end |
#render ⇒ Object
Returns the contents of the file.
14 15 16 17 |
# File 'lib/webby/resources/static.rb', line 14 def render Webby.deprecated "render", "it is being replaced by the Renderer#render() method" self._read end |