Class: Skriptorium::Local::Destination
- Inherits:
-
BaseDestination
- Object
- BaseDestination
- Skriptorium::Local::Destination
- Defined in:
- lib/skriptorium/local/destination.rb
Instance Attribute Summary
Attributes inherited from BaseDestination
Instance Method Summary collapse
- #exists?(article) ⇒ Boolean
-
#initialize(config) ⇒ Destination
constructor
A new instance of Destination.
- #publish(article) ⇒ Object
Methods inherited from BaseDestination
Constructor Details
#initialize(config) ⇒ Destination
Returns a new instance of Destination.
6 7 8 9 10 |
# File 'lib/skriptorium/local/destination.rb', line 6 def initialize(config) super @path = config['path'] @format = config.fetch('format', 'html') end |
Instance Method Details
#exists?(article) ⇒ Boolean
12 13 14 |
# File 'lib/skriptorium/local/destination.rb', line 12 def exists?(article) File.exist?(filepath(article)) end |
#publish(article) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/skriptorium/local/destination.rb', line 16 def publish(article) FileUtils.mkdir_p(@path) if @format == 'html' File.write(filepath(article), article.to_html) else File.write(filepath(article), article.to_markdown) end puts " Saved to Local: #{filepath(article)}" end |