Use ActiveSupport Hash#assert_valid_keys instend of refinement

This commit is contained in:
Douglas Eichelberger 2023-03-19 17:31:51 -07:00
parent 98a2923463
commit 516c61057b
6 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,7 @@ module Cask
attr_reader :directives
def initialize(cask, directives)
directives.assert_valid_keys!(*ORDERED_DIRECTIVES)
directives.assert_valid_keys(*ORDERED_DIRECTIVES)
super(cask, **directives)
directives[:signal] = Array(directives[:signal]).flatten.each_slice(2).to_a

View File

@ -67,7 +67,7 @@ module Cask
)
end
args.assert_valid_keys!(*VALID_KEYS)
args.assert_valid_keys(*VALID_KEYS)
new(cask, **args)
end

View File

@ -18,7 +18,7 @@ module Cask
attr_reader :path, :stanza_options
def self.from_args(cask, path, **stanza_options)
stanza_options.assert_valid_keys!(:allow_untrusted, :choices)
stanza_options.assert_valid_keys(:allow_untrusted, :choices)
new(cask, path, **stanza_options)
end

View File

@ -20,7 +20,7 @@ module Cask
if target_hash
raise CaskInvalidError unless target_hash.respond_to?(:keys)
target_hash.assert_valid_keys!(:target)
target_hash.assert_valid_keys(:target)
end
target_hash ||= {}

View File

@ -110,8 +110,8 @@ module Cask
return
end
@env&.assert_valid_keys!(*self.class.defaults.keys)
@explicit.assert_valid_keys!(*self.class.defaults.keys)
@env&.assert_valid_keys(*self.class.defaults.keys)
@explicit.assert_valid_keys(*self.class.defaults.keys)
end
sig { returns(T::Hash[Symbol, T.any(String, Pathname, T::Array[String])]) }

View File

@ -22,7 +22,7 @@ module Cask
].freeze
def initialize(**options)
options.assert_valid_keys!(*VALID_KEYS)
options.assert_valid_keys(*VALID_KEYS)
conflicts = options.transform_values { |v| Set.new(Kernel.Array(v)) }
conflicts.default = Set.new