diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-13 11:59:52 -0500 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-04-27 12:23:26 -0500 |
commit | 7f625f06d333cbe3846081924a3e7016b2846ae0 (patch) | |
tree | 5b70dc5cec031869ddb84f7bceb2c0aedb3dfaf9 /app/models/blob.rb | |
parent | 00e4ec55c3b8757e6d5fb8bf3176dd7e20966b3a (diff) | |
download | gitlab-ce-7f625f06d333cbe3846081924a3e7016b2846ae0.tar.gz |
Pass project to Blob
Diffstat (limited to 'app/models/blob.rb')
-rw-r--r-- | app/models/blob.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/blob.rb b/app/models/blob.rb index 55872acef51..c6315a6789f 100644 --- a/app/models/blob.rb +++ b/app/models/blob.rb @@ -6,6 +6,8 @@ class Blob < SimpleDelegator # The maximum size of an SVG that can be displayed. MAXIMUM_SVG_SIZE = 2.megabytes + attr_reader :project + # Wrap a Gitlab::Git::Blob object, or return nil when given nil # # This method prevents the decorated object from evaluating to "truthy" when @@ -16,10 +18,16 @@ class Blob < SimpleDelegator # # blob = Blob.decorate(nil) # puts "truthy" if blob # No output - def self.decorate(blob) + def self.decorate(blob, project) return if blob.nil? - new(blob) + new(blob, project) + end + + def initialize(blob, project) + @project = project + + super(blob) end # Returns the data of the blob. |