Sha256: c293f246de5eba712b78d94c08d85dae2b1c61845919313a4e7f0fa0ded3751e

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

class GhostWriter::IndexWriter
  class Base
    def initialize(document_index)
      @document_index = document_index
    end

    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

    private

    def extname
      raise NotImplementedError
    end

    def template
      raise NotImplementedError
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ghost_writer-0.5.0 lib/ghost_writer/index_writer/base.rb
ghost_writer-0.4.2 lib/ghost_writer/index_writer/base.rb