Commit 8121c30d authored by David Fernandez's avatar David Fernandez

Use a dedicated inner class for search results

parent 4ca69686
......@@ -17,8 +17,6 @@ module Packages
padding: 0
}.freeze
RESULT = Struct.new(:results, :total_count, keyword_init: true).freeze
def initialize(current_user, project_or_group, search_term, options = {})
@current_user = current_user
@project_or_group = project_or_group
......@@ -30,7 +28,7 @@ module Packages
end
def execute
RESULT.new(
Result.new(
total_count: non_paginated_matching_package_names.count,
results: search_packages
)
......@@ -152,6 +150,12 @@ module Packages
def per_page
[@options[:per_page], MAX_PER_PAGE].min
end
class Result
include ActiveModel::Model
attr_accessor :results, :total_count
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment