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

section.rb « navigation « gitlab « lib - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dc470cb95dbbd3a3435b11bb79785127e167a3aa (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
# frozen_string_literal: true

module Gitlab
  class Navigation
    class Section
      def initialize(section)
        @section = section
      end

      def title
        section[:section_title]
      end

      def ee_only?
        section[:ee_only]
      end

      def ee_tier
        section[:ee_tier]
      end

      def url
        section[:section_url]
      end

      def has_children?
        !children.empty?
      end

      def children
        @children ||= section.fetch(:section_categories, []).map { |cat| Category.new(cat) }
      end

      private

      attr_reader :section
    end
  end
end