summaryrefslogtreecommitdiff
path: root/lib/sidebars/context.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sidebars/context.rb')
-rw-r--r--lib/sidebars/context.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/sidebars/context.rb b/lib/sidebars/context.rb
new file mode 100644
index 00000000000..d9ac2705aaf
--- /dev/null
+++ b/lib/sidebars/context.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+# This class stores all the information needed to display and
+# render the sidebar and menus.
+# It usually stores information regarding the context and calculated
+# values where the logic is in helpers.
+module Sidebars
+ class Context
+ attr_reader :current_user, :container
+
+ def initialize(current_user:, container:, **args)
+ @current_user = current_user
+ @container = container
+
+ args.each do |key, value|
+ singleton_class.public_send(:attr_reader, key) # rubocop:disable GitlabSecurity/PublicSend
+ instance_variable_set("@#{key}", value)
+ end
+ end
+ end
+end