Class: Gitlab::Graphql::Loaders::IssuableLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/graphql/loaders/issuable_loader.rb

Defined Under Namespace

Classes: BatchKey

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, issuable_finder) ⇒ IssuableLoader

Returns a new instance of IssuableLoader.


11
12
13
14
# File 'lib/gitlab/graphql/loaders/issuable_loader.rb', line 11

def initialize(parent, issuable_finder)
  @parent = parent
  @issuable_finder = issuable_finder
end

Instance Attribute Details

#issuable_finderObject (readonly)

Returns the value of attribute issuable_finder.


7
8
9
# File 'lib/gitlab/graphql/loaders/issuable_loader.rb', line 7

def issuable_finder
  @issuable_finder
end

#parentObject (readonly)

Returns the value of attribute parent.


7
8
9
# File 'lib/gitlab/graphql/loaders/issuable_loader.rb', line 7

def parent
  @parent
end

Instance Method Details

#batching_find_all(&with_query) ⇒ Object


16
17
18
19
20
21
22
23
# File 'lib/gitlab/graphql/loaders/issuable_loader.rb', line 16

def batching_find_all(&with_query)
  if issuable_finder.params.keys == ['iids']
    issuable_finder.parent = parent
    batch_load_issuables(issuable_finder.params[:iids], with_query)
  else
    post_process(find_all, with_query)
  end
end

#find_allObject


25
26
27
28
# File 'lib/gitlab/graphql/loaders/issuable_loader.rb', line 25

def find_all
  issuable_finder.parent_param = parent if parent
  issuable_finder.execute
end