diff options
Diffstat (limited to 'app/presenters')
3 files changed, 22 insertions, 25 deletions
diff --git a/app/presenters/packages/conan/package_presenter.rb b/app/presenters/packages/conan/package_presenter.rb index 0c7a81038dd..2fab074c69c 100644 --- a/app/presenters/packages/conan/package_presenter.rb +++ b/app/presenters/packages/conan/package_presenter.rb @@ -80,10 +80,9 @@ module Packages def package_files return unless @package - strong_memoize(:package_files) do - @package.installable_package_files.preload_conan_file_metadata - end + @package.installable_package_files.preload_conan_file_metadata end + strong_memoize_attr :package_files def matching_reference?(package_file) package_file.conan_file_metadatum.conan_package_reference == conan_package_reference diff --git a/app/presenters/packages/nuget/packages_metadata_presenter.rb b/app/presenters/packages/nuget/packages_metadata_presenter.rb index 9f1dee17cea..10a19060f8a 100644 --- a/app/presenters/packages/nuget/packages_metadata_presenter.rb +++ b/app/presenters/packages/nuget/packages_metadata_presenter.rb @@ -59,11 +59,10 @@ module Packages end def sorted_versions - strong_memoize(:sorted_versions) do - versions = @packages.map(&:version).compact - VersionSorter.sort(versions) - end + versions = @packages.map(&:version).compact + VersionSorter.sort(versions) end + strong_memoize_attr :sorted_versions end end end diff --git a/app/presenters/packages/nuget/search_results_presenter.rb b/app/presenters/packages/nuget/search_results_presenter.rb index dc391c380f3..311296d576c 100644 --- a/app/presenters/packages/nuget/search_results_presenter.rb +++ b/app/presenters/packages/nuget/search_results_presenter.rb @@ -14,26 +14,25 @@ module Packages end def data - strong_memoize(:data) do - @search.results.group_by(&:name).map do |package_name, packages| - latest_version = latest_version(packages) - latest_package = packages.find { |pkg| pkg.version == latest_version } - - { - type: 'Package', - authors: '', - name: package_name, - version: latest_version, - versions: build_package_versions(packages), - summary: '', - total_downloads: 0, - verified: true, - tags: tags_for(latest_package), - metadatum: metadatum_for(latest_package) - } - end + @search.results.group_by(&:name).map do |package_name, packages| + latest_version = latest_version(packages) + latest_package = packages.find { |pkg| pkg.version == latest_version } + + { + type: 'Package', + authors: '', + name: package_name, + version: latest_version, + versions: build_package_versions(packages), + summary: '', + total_downloads: 0, + verified: true, + tags: tags_for(latest_package), + metadatum: metadatum_for(latest_package) + } end end + strong_memoize_attr :data private |