Class: Gitlab::IssuableMetadata

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/issuable_metadata.rb

Defined Under Namespace

Classes: IssuableMeta

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(current_user, issuable_collection) ⇒ IssuableMetadata

Returns a new instance of IssuableMetadata.


20
21
22
23
24
25
# File 'lib/gitlab/issuable_metadata.rb', line 20

def initialize(current_user, issuable_collection)
  @current_user = current_user
  @issuable_collection = issuable_collection

  validate_collection!
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user


18
19
20
# File 'lib/gitlab/issuable_metadata.rb', line 18

def current_user
  @current_user
end

#issuable_collectionObject (readonly)

Returns the value of attribute issuable_collection


18
19
20
# File 'lib/gitlab/issuable_metadata.rb', line 18

def issuable_collection
  @issuable_collection
end

Instance Method Details

#dataObject


27
28
29
30
31
32
33
# File 'lib/gitlab/issuable_metadata.rb', line 27

def data
  return {} if issuable_ids.empty?

  issuable_ids.each_with_object({}) do |id, issuable_meta|
    issuable_meta[id] = (id)
  end
end