summaryrefslogtreecommitdiff
path: root/lib/api/helpers/snippets_helpers.rb
blob: 20aeca6a9d34f3491526b342e8a6a339e4e129ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module API
  module Helpers
    module SnippetsHelpers
      def content_for(snippet)
        if snippet.empty_repo?
          snippet.content
        else
          blob = snippet.blobs.first
          blob.load_all_data!
          blob.data
        end
      end
    end
  end
end