debian-mirror-gitlab/app/finders/bulk_imports/imports_finder.rb

25 lines
436 B
Ruby
Raw Normal View History

2021-09-30 23:02:18 +05:30
# frozen_string_literal: true
module BulkImports
class ImportsFinder
def initialize(user:, status: nil)
@user = user
@status = status
end
def execute
filter_by_status(user.bulk_imports)
end
private
attr_reader :user, :status
def filter_by_status(imports)
return imports unless BulkImport.all_human_statuses.include?(status)
imports.with_status(status)
end
end
end