Class: RhetButler::Stasis::Writer
- Inherits:
-
Object
- Object
- RhetButler::Stasis::Writer
- Defined in:
- lib/rhet-butler/stasis/writer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#store_log ⇒ Object
Returns the value of attribute store_log.
Instance Method Summary collapse
-
#initialize(root) ⇒ Writer
constructor
A new instance of Writer.
- #store(path, content) ⇒ Object
- #write(path, content) ⇒ Object
Constructor Details
Instance Attribute Details
#store_log ⇒ Object
Returns the value of attribute store_log.
8 9 10 |
# File 'lib/rhet-butler/stasis/writer.rb', line 8 def store_log @store_log end |
Instance Method Details
#store(path, content) ⇒ Object
15 16 17 18 19 |
# File 'lib/rhet-butler/stasis/writer.rb', line 15 def store(path, content) File::open(File::join(@root, path), "w") do |file| file.write(content) end end |
#write(path, content) ⇒ Object
10 11 12 13 |
# File 'lib/rhet-butler/stasis/writer.rb', line 10 def write(path, content) store_log.puts "Writing: #{path}" if store_log.respond_to? :puts store(path, content) end |