debian-mirror-gitlab/app/finders/packages/package_file_finder.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
587 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
class Packages::PackageFileFinder
attr_reader :package, :file_name, :params
def initialize(package, file_name, params = {})
@package = package
@file_name = file_name
@params = params
end
def execute
package_files.last
end
def execute!
package_files.last!
end
private
def package_files
2022-04-04 11:22:00 +05:30
by_file_name(package.installable_package_files)
2020-07-28 23:09:34 +05:30
end
def by_file_name(files)
if params[:with_file_name_like]
files.with_file_name_like(file_name)
else
files.with_file_name(file_name)
end
end
end