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

wiki_page.rb « git « gitlab « lib « ruby - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d206a4c66f44e01a32cdc8361083f77b32761083 (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
33
34
35
module Gitlab
  module Git
    class WikiPage
      attr_reader :url_path, :title, :format, :path, :version, :raw_data, :name, :historical

      def initialize(gollum_page, version, with_raw_data: true)
        @gollum_page = gollum_page

        @url_path = gollum_page.url_path
        @title = gollum_page.title
        @format = gollum_page.format
        @path = gollum_page.path
        @raw_data = gollum_page.raw_data if with_raw_data
        @name = gollum_page.name
        @historical = gollum_page.historical?

        @version = version
      end

      def formatted_data
        @gollum_page.formatted_data
      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