brew/Library/Homebrew/cask/dsl/conflicts_with.rb
Douglas Eichelberger 4dcd5ac47f Remove HashValidator
2023-03-19 17:37:58 -07:00

36 lines
695 B
Ruby

# typed: true
# frozen_string_literal: true
require "delegate"
module Cask
class DSL
# Class corresponding to the `conflicts_with` stanza.
#
# @api private
class ConflictsWith < SimpleDelegator
VALID_KEYS = [
:formula,
:cask,
:macos,
:arch,
:x11,
:java,
].freeze
def initialize(**options)
options.assert_valid_keys(*VALID_KEYS)
conflicts = options.transform_values { |v| Set.new(Kernel.Array(v)) }
conflicts.default = Set.new
super(conflicts)
end
def to_json(generator)
__getobj__.transform_values(&:to_a).to_json(generator)
end
end
end
end