module Snuffle::Formatters::Base
Public Class Methods
included(klass)
click to toggle source
# File lib/snuffle/formatters/base.rb, line 7 def self.included(klass) klass.send(:attr_accessor, :summary) klass.send(:attr_accessor, :source) end
new(summary, source="")
click to toggle source
# File lib/snuffle/formatters/base.rb, line 12 def initialize(summary, source="") self.summary = summary self.source = source end
Public Instance Methods
columns()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 21 def columns ["filename", "host class", "candidate object attributes", "source line numbers"] end
content()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 17 def content [header, rows, footer].flatten.join("\r\n") end
export()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 49 def export outfile = File.open("#{path_to_results}", 'w') outfile.write(content) outfile.close path_to_results end
file_extension()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 45 def file_extension "" end
filename()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 41 def filename "#{summary.filename}" + file_extension end
output_path()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 29 def output_path return @output_path if @output_path path = root_path path << "/" + summary.path_to_results if summary FileUtils.mkpath(path) @output_path = path end
path_to_results()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 37 def path_to_results "#{output_path}/#{filename}" end
root_path()
click to toggle source
# File lib/snuffle/formatters/base.rb, line 25 def root_path "doc/snuffle" end