Class: Sidebars::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/sidebars/context.rb

Direct Known Subclasses

Groups::Context, Projects::Context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_user:, container:, **args) ⇒ Context

Returns a new instance of Context.


11
12
13
14
15
16
17
18
19
# File 'lib/sidebars/context.rb', line 11

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

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.


9
10
11
# File 'lib/sidebars/context.rb', line 9

def container
  @container
end

#current_userObject (readonly)

Returns the value of attribute current_user.


9
10
11
# File 'lib/sidebars/context.rb', line 9

def current_user
  @current_user
end