Class: ReleasesFinder

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/finders/releases_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(parent, current_user = nil, params = {}) ⇒ ReleasesFinder

Returns a new instance of ReleasesFinder.


8
9
10
11
12
# File 'app/finders/releases_finder.rb', line 8

def initialize(parent, current_user = nil, params = {})
  @parent = parent
  @current_user = current_user
  @params = params
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user


6
7
8
# File 'app/finders/releases_finder.rb', line 6

def current_user
  @current_user
end

#paramsObject (readonly)

Returns the value of attribute params


6
7
8
# File 'app/finders/releases_finder.rb', line 6

def params
  @params
end

#parentObject (readonly)

Returns the value of attribute parent


6
7
8
# File 'app/finders/releases_finder.rb', line 6

def parent
  @parent
end

Instance Method Details

#execute(preload: true) ⇒ Object


14
15
16
17
18
19
20
21
# File 'app/finders/releases_finder.rb', line 14

def execute(preload: true)
  return Release.none if projects.empty?

  releases = get_releases
  releases = by_tag(releases)
  releases = releases.preloaded if preload
  releases.sorted
end