File indexing completed on 2022-09-27 15:18:57

0001 # frozen_string_literal: true
0002 #
0003 # Copyright (C) 2016 Rohan Garg <rohan@garg.io>
0004 #
0005 # This library is free software; you can redistribute it and/or
0006 # modify it under the terms of the GNU Lesser General Public
0007 # License as published by the Free Software Foundation; either
0008 # version 2.1 of the License, or (at your option) version 3, or any
0009 # later version accepted by the membership of KDE e.V. (or its
0010 # successor approved by the membership of KDE e.V.), which shall
0011 # act as a proxy defined in Section 6 of version 3 of the license.
0012 #
0013 # This library is distributed in the hope that it will be useful,
0014 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016 # Lesser General Public License for more details.
0017 #
0018 # You should have received a copy of the GNU Lesser General Public
0019 # License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 require_relative 'architecture'
0022 
0023 module Debian
0024   # Class to represent architecture qualifiers in a debian control file
0025   class ArchitectureQualifier
0026     attr_accessor :architectures
0027 
0028     def initialize(architectures)
0029       @architectures =
0030         architectures.split.collect { |arch| Architecture.new(arch) }
0031     end
0032 
0033     def qualifies?(other)
0034       @architectures.any? { |x| x.qualify?(other) }
0035     end
0036 
0037     def to_s
0038       @architectures.join(' ')
0039     end
0040   end
0041 end