Class: CodeClimate::TestReporter::ShortenFilename
- Inherits:
-
Object
- Object
- CodeClimate::TestReporter::ShortenFilename
- Defined in:
- lib/code_climate/test_reporter/shorten_filename.rb
Instance Method Summary collapse
-
#initialize(filename) ⇒ ShortenFilename
constructor
A new instance of ShortenFilename.
- #short_filename ⇒ Object
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_filename ⇒ Object
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 |