gitlab-org--gitlab-foss/app/models/concerns/blob_language_from_git_attributes.rb
Mark Chao a4ba973e24 Allow FoundBlob to access language from gitattributes
Extract language_from_git_attributes as a concern so it can
ben included in two blob classes.
2018-10-30 15:44:55 +08:00

13 lines
318 B
Ruby

# frozen_string_literal: true
# Applicable for blob classes with project attribute
module BlobLanguageFromGitAttributes
extend ActiveSupport::Concern
def language_from_gitattributes
return nil unless project
repository = project.repository
repository.gitattribute(path, 'gitlab-language')
end
end