Sha256: c5d7ebc7f27e137091b1aa524a13f1a0b84c881df3173dc9d2da55921f61f44d

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

module Formatters

  module Base

    def self.included(klass)
      klass.send(:attr_accessor, :file)
      klass.send(:attr_accessor, :source)
      klass.send(:attr_accessor, :output_directory)
    end

    def initialize(file, output_directory=nil, source="")
      self.file = file
      self.source = source
      self.output_directory = output_directory
    end

    def filename
      File.basename(self.file.path_to_file) + file_extension
    end

    def output_path
      output_path = File.dirname(File.join(self.output_directory, self.file.path_to_file))
      FileUtils.mkpath(output_path)
      output_path
    end

    def path_to_results
      File.join(output_path, filename)
    end

  end

end

Version data entries

4 entries across 3 versions & 2 rubygems

Version Path
analyst-0.13.1 lib/analyst/formatters/base.rb
analyst-0.13.1 lib/analyst/fukuzatsu/formatters/base.rb
fukuzatsu-1.0.6 lib/fukuzatsu/formatters/base.rb
fukuzatsu-1.0.5 lib/fukuzatsu/formatters/base.rb