Class: CodeClimate::TestReporter::ShortenFilename

Inherits:
Object
  • Object
show all
Defined in:
lib/code_climate/test_reporter/shorten_filename.rb

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ ShortenFilename

Returns a new instance of ShortenFilename.



4
5
6
# File 'lib/code_climate/test_reporter/shorten_filename.rb', line 4

def initialize(filename)
  @filename = filename
end

Instance Method Details

#short_filenameObject



8
9
10
11
# 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