Class: GhostWriter::IndexWriter::Base
- Inherits:
-
Object
- Object
- GhostWriter::IndexWriter::Base
- Defined in:
- lib/ghost_writer/index_writer/base.rb
Instance Method Summary collapse
-
#initialize(document_index) ⇒ Base
constructor
A new instance of Base.
- #write_file ⇒ Object
Constructor Details
#initialize(document_index) ⇒ Base
Returns a new instance of Base.
3 4 5 |
# File 'lib/ghost_writer/index_writer/base.rb', line 3 def initialize(document_index) @document_index = document_index end |
Instance Method Details
#write_file ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/ghost_writer/index_writer/base.rb', line 7 def write_file unless File.exist?(File.dirname(@document_index.basename)) FileUtils.mkdir_p(File.dirname(@document_index.basename)) end File.open("#{@document_index.basename}.#{extname}", "w") do |f| f.write template.result(@document_index.instance_eval { binding }) end end |