Class: Packages::Conan::PackagePresenter

Inherits:
Object
  • Object
show all
Includes:
API::Helpers::RelatedResourcesHelpers, Gitlab::Utils::StrongMemoize
Defined in:
app/presenters/packages/conan/package_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from API::Helpers::RelatedResourcesHelpers

#expose_path, #expose_url, #issues_available?, #mrs_available?

Constructor Details

#initialize(package, user, project, params = {}) ⇒ PackagePresenter

Returns a new instance of PackagePresenter.


11
12
13
14
15
16
# File 'app/presenters/packages/conan/package_presenter.rb', line 11

def initialize(package, user, project, params = {})
  @package = package
  @user = user
  @project = project
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params


9
10
11
# File 'app/presenters/packages/conan/package_presenter.rb', line 9

def params
  @params
end

Instance Method Details

#package_snapshotObject


38
39
40
41
42
43
44
# File 'app/presenters/packages/conan/package_presenter.rb', line 38

def package_snapshot
  map_package_files do |package_file|
    next unless package_file.conan_file_metadatum.package_file? && matching_reference?(package_file)

    package_file.file_md5
  end
end

#package_urlsObject


30
31
32
33
34
35
36
# File 'app/presenters/packages/conan/package_presenter.rb', line 30

def package_urls
  map_package_files do |package_file|
    next unless package_file.conan_file_metadatum.package_file? && matching_reference?(package_file)

    build_package_file_url(package_file)
  end
end

#recipe_snapshotObject


24
25
26
27
28
# File 'app/presenters/packages/conan/package_presenter.rb', line 24

def recipe_snapshot
  map_package_files do |package_file|
    package_file.file_md5 if package_file.conan_file_metadatum.recipe_file?
  end
end

#recipe_urlsObject


18
19
20
21
22
# File 'app/presenters/packages/conan/package_presenter.rb', line 18

def recipe_urls
  map_package_files do |package_file|
    build_recipe_file_url(package_file) if package_file.conan_file_metadatum.recipe_file?
  end
end