Sha256: 02c6cdb6df8c309cbee75c5d4a5004d6f9fd2e85c0af6871bd0df31157da61d6

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

module Snuffle

  module Formatters

    module Base

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

      def initialize(summary, source="")
        self.summary = summary
        self.source = source
      end

      def content
        [header, rows, footer].flatten.join("\r\n")
      end

      def columns
        ["filename", "host class", "candidate object attributes", "source line numbers"]
      end

      def root_path
        "doc/snuffle"
      end

      def output_path
        FileUtils.mkpath(root_path)
        root_path
      end

      def path_to_results
        "#{output_path}/#{filename}"
      end

      def filename
        base = summary.class_filename
        base + file_extension
      end

      def file_extension
        ""
      end

      def export
        outfile = File.open("#{path_to_results}", 'w')
        outfile.write(content)
        outfile.close
        path_to_results
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snuffle-0.12.0 lib/snuffle/formatters/base.rb
snuffle-0.11.1 lib/snuffle/formatters/base.rb
snuffle-0.10.1 lib/snuffle/formatters/base.rb
snuffle-0.9.1 lib/snuffle/formatters/base.rb