Module: Webgen::Output
- Defined in:
- lib/webgen/output.rb,
lib/webgen/output/filesystem.rb
Overview
Namespace for all classes that know how to write out node content.
Implementing an output class
Output classes know how to write rendered node data to an output location.
An output class must respond to three methods
exists?(path)-
Return
trueif the output path exists. delete(path)-
Delete the given output path.
write(path, data, type)-
Write the data to the given output path. The parameter
typespecifies the type of the to be written path::fileor:directory.
read(path):
Return the content of the given path if it exists or raise an error otherwise.
Defined Under Namespace
Classes: FileSystem
Class Method Summary collapse
-
.instance ⇒ Object
Returns an instance of the configured output class.
Class Method Details
.instance ⇒ Object
Returns an instance of the configured output class.
26 27 28 29 30 31 32 33 |
# File 'lib/webgen/output.rb', line 26 def self.instance classes = (WebsiteAccess.website.cache.volatile[:classes] ||= {}) unless classes.has_key?(:output_instance) klass, *args = WebsiteAccess.website.config['output'] classes[:output_instance] = Object.constant(klass).new(*args) end classes[:output_instance] end |