summaryrefslogtreecommitdiff
path: root/app/presenters/blob_presenter.rb
blob: 6323c1b33898570f62f56bdd4c87fd4aeca09dac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class BlobPresenter < Gitlab::View::Presenter::Simple
  presents :blob

  def highlight(plain: nil)
    blob.load_all_data! if blob.respond_to?(:load_all_data!)

    Gitlab::Highlight.highlight(
      blob.path,
      blob.data,
      language: blob.language_from_gitattributes,
      plain: plain
    )
  end
end