Method: Beaker::Options::Validator#validate_tags

Defined in:
lib/beaker/options/validator.rb

#validate_tags(include, exclude) ⇒ nil

Raise an error if an item exists in both the include and exclude lists.

Parameters:

  • include (Array)

    included items

  • exclude (Array)

    excluded items

Returns:

  • (nil)

    Does not return anything



87
88
89
90
91
92
93
94
95
# File 'lib/beaker/options/validator.rb', line 87

def validate_tags(include, exclude)
  include.each do |included_tag|
    # select items from exclude set that match included_tag
    # no match is an empty list/array/[]
    if exclude.select { |ex| ex == included_tag } != []
      validator_error "tag '#{included_tag}' cannot be in both the included and excluded tag sets"
    end
  end
end