Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wiki_page.rb « git « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a1f3d64ccdeba3d73b285d162055057d8992f06c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module Gitlab
  module Git
    class WikiPage
      attr_reader :url_path, :title, :format, :path, :version, :raw_data, :name, :historical, :formatted_data

      # This class abstracts away Gitlab::GitalyClient::WikiPage
      def initialize(gitaly_page, version)
        @url_path = gitaly_page.url_path
        @title = gitaly_page.title
        @format = gitaly_page.format
        @path = gitaly_page.path
        @raw_data = gitaly_page.raw_data
        @name = gitaly_page.name
        @historical = gitaly_page.historical?

        @version = version
      end

      def historical?
        @historical
      end

      def text_data
        return @text_data if defined?(@text_data)

        @text_data = @raw_data && Gitlab::EncodingHelper.encode!(@raw_data.dup)
      end
    end
  end
end