Sha256: dba13f3f1af039a62c77d5e3a63677a1c9b2d1efd439bb194c36b96bdaa7ebfd

Contents?: true

Size: 383 Bytes

Versions: 2

Compression:

Stored size: 383 Bytes

Contents

# frozen_string_literal: true

module Signore
  Tags = Struct.new(:forbidden, :required) do
    def initialize(forbidden: [], required: [])
      super forbidden, required
    end

    def match?(sig_tags)
      (required & sig_tags) == required and (forbidden & sig_tags).empty?
    end

    def to_s
      (required + forbidden.map { |tag| '~' + tag }).join(' ')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
signore-0.6.0 lib/signore/tags.rb
signore-0.5.0 lib/signore/tags.rb