Sha256: de3292dc1ee416f4f034065133b616a5f125d933b2797a35c211456a84d63361

Contents?: true

Size: 710 Bytes

Versions: 5

Compression:

Stored size: 710 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, 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

5 entries across 5 versions & 1 rubygems

Version Path
fukuzatsu-1.0.4 lib/fukuzatsu/formatters/base.rb
fukuzatsu-1.0.3 lib/fukuzatsu/formatters/base.rb
fukuzatsu-1.0.2 lib/fukuzatsu/formatters/base.rb
fukuzatsu-1.0.1 lib/fukuzatsu/formatters/base.rb
fukuzatsu-1.0.0 lib/fukuzatsu/formatters/base.rb