debian-mirror-gitlab/lib/gitlab/diff/file_collection/merge_request_diff.rb

42 lines
745 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2016-09-13 17:45:13 +05:30
module Gitlab
module Diff
module FileCollection
2019-12-21 20:55:43 +05:30
class MergeRequestDiff < MergeRequestDiffBase
2016-09-13 17:45:13 +05:30
def diff_files
2018-03-27 19:54:05 +05:30
diff_files = super
2018-11-20 20:47:30 +05:30
diff_files.each { |diff_file| cache.decorate(diff_file) }
2018-03-27 19:54:05 +05:30
diff_files
2016-09-13 17:45:13 +05:30
end
2018-11-20 20:47:30 +05:30
override :write_cache
def write_cache
cache.write_if_empty
2017-08-17 22:00:37 +05:30
end
2018-11-20 20:47:30 +05:30
override :clear_cache
def clear_cache
cache.clear
2018-05-09 12:01:36 +05:30
end
def cache_key
2018-11-20 20:47:30 +05:30
cache.key
2016-09-13 17:45:13 +05:30
end
2018-11-20 20:47:30 +05:30
def real_size
@merge_request_diff.real_size
2016-09-13 17:45:13 +05:30
end
2018-11-20 20:47:30 +05:30
private
2016-09-13 17:45:13 +05:30
2018-11-20 20:47:30 +05:30
def cache
@cache ||= Gitlab::Diff::HighlightCache.new(self)
2016-09-13 17:45:13 +05:30
end
end
end
end
end