Skip to content

Commit

Permalink
Merge pull request #453 from paddor/master
Browse files Browse the repository at this point in the history
memoize SimpleCov::Configuration#coverage_path
  • Loading branch information
colszowka committed Jan 26, 2016
2 parents 54180c0 + 4253d56 commit 619e522
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/simplecov/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def root(root = nil)
#
def coverage_dir(dir = nil)
return @coverage_dir if defined?(@coverage_dir) && dir.nil?
@coverage_path = nil # invalidate cache
@coverage_dir = (dir || "coverage")
end

Expand All @@ -37,9 +38,11 @@ def coverage_dir(dir = nil)
# values. Will create the directory if it's missing
#
def coverage_path
coverage_path = File.expand_path(coverage_dir, root)
FileUtils.mkdir_p coverage_path
coverage_path
@coverage_path ||= begin
coverage_path = File.expand_path(coverage_dir, root)
FileUtils.mkdir_p coverage_path
coverage_path
end
end

#
Expand Down

0 comments on commit 619e522

Please sign in to comment.