debian-mirror-gitlab/app/finders/achievements/achievements_finder.rb
2023-06-20 00:43:36 +05:30

29 lines
503 B
Ruby

# frozen_string_literal: true
module Achievements
class AchievementsFinder
attr_reader :namespace, :params
def initialize(namespace, params = {})
@namespace = namespace
@params = params
end
def execute
achievements = namespace.achievements
by_ids(achievements)
end
private
def by_ids(achievements)
return achievements unless ids?
achievements.id_in(params[:ids])
end
def ids?
params[:ids].present?
end
end
end