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

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/navigation/category.rb')
-rw-r--r--lib/gitlab/navigation/category.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/gitlab/navigation/category.rb b/lib/gitlab/navigation/category.rb
new file mode 100644
index 00000000..75f401fa
--- /dev/null
+++ b/lib/gitlab/navigation/category.rb
@@ -0,0 +1,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