class CodeClimate::TestReporter::ShortenFilename
Public Class Methods
new(filename)
click to toggle source
# File lib/code_climate/test_reporter/shorten_filename.rb, line 4 def initialize(filename) @filename = filename end
Public Instance Methods
short_filename()
click to toggle source
# File lib/code_climate/test_reporter/shorten_filename.rb, line 8 def short_filename return @filename unless ::SimpleCov.root apply_prefix @filename.gsub(/^#{Regexp.escape(::SimpleCov.root)}/, ".").gsub(%r{^\./}, "") end
Private Instance Methods
apply_prefix(filename)
click to toggle source
# File lib/code_climate/test_reporter/shorten_filename.rb, line 15 def apply_prefix(filename) if (prefix = CodeClimate::TestReporter.configuration.path_prefix) File.join(prefix, filename) else filename end end