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

category.rb « navigation « gitlab « lib - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 75f401fa0c715fe63f1a76a4d16bbec2f747ef43 (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
36
37
38
39
40
41
module Gitlab
  class Navigation
    class Category
      def initialize(category)
        @category = category
      end

      def title
        category[:category_title]
      end

      def external_url
        category[:external_url]
      end

      def url
        category[:category_url]
      end

      def ee_only?
        category[:ee_only]
      end

      def ee_tier
        category[:ee_tier]
      end

      def has_children?
        !children.empty?
      end

      def children
        @children ||= category.fetch(:docs, []).map { |doc| Doc.new(doc) }
      end

      private

      attr_reader :category
    end
  end
end