Use ActiveSupport Hash#assert_valid_keys instend of refinement
This commit is contained in:
parent
98a2923463
commit
516c61057b
@ -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
|
||||
|
@ -67,7 +67,7 @@ module Cask
|
||||
)
|
||||
end
|
||||
|
||||
args.assert_valid_keys!(*VALID_KEYS)
|
||||
args.assert_valid_keys(*VALID_KEYS)
|
||||
new(cask, **args)
|
||||
end
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 ||= {}
|
||||
|
@ -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])]) }
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user