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
|
attr_reader :directives
|
||||||
|
|
||||||
def initialize(cask, directives)
|
def initialize(cask, directives)
|
||||||
directives.assert_valid_keys!(*ORDERED_DIRECTIVES)
|
directives.assert_valid_keys(*ORDERED_DIRECTIVES)
|
||||||
|
|
||||||
super(cask, **directives)
|
super(cask, **directives)
|
||||||
directives[:signal] = Array(directives[:signal]).flatten.each_slice(2).to_a
|
directives[:signal] = Array(directives[:signal]).flatten.each_slice(2).to_a
|
||||||
|
@ -67,7 +67,7 @@ module Cask
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
args.assert_valid_keys!(*VALID_KEYS)
|
args.assert_valid_keys(*VALID_KEYS)
|
||||||
new(cask, **args)
|
new(cask, **args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ module Cask
|
|||||||
attr_reader :path, :stanza_options
|
attr_reader :path, :stanza_options
|
||||||
|
|
||||||
def self.from_args(cask, 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)
|
new(cask, path, **stanza_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ module Cask
|
|||||||
if target_hash
|
if target_hash
|
||||||
raise CaskInvalidError unless target_hash.respond_to?(:keys)
|
raise CaskInvalidError unless target_hash.respond_to?(:keys)
|
||||||
|
|
||||||
target_hash.assert_valid_keys!(:target)
|
target_hash.assert_valid_keys(:target)
|
||||||
end
|
end
|
||||||
|
|
||||||
target_hash ||= {}
|
target_hash ||= {}
|
||||||
|
@ -110,8 +110,8 @@ module Cask
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@env&.assert_valid_keys!(*self.class.defaults.keys)
|
@env&.assert_valid_keys(*self.class.defaults.keys)
|
||||||
@explicit.assert_valid_keys!(*self.class.defaults.keys)
|
@explicit.assert_valid_keys(*self.class.defaults.keys)
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T::Hash[Symbol, T.any(String, Pathname, T::Array[String])]) }
|
sig { returns(T::Hash[Symbol, T.any(String, Pathname, T::Array[String])]) }
|
||||||
|
@ -22,7 +22,7 @@ module Cask
|
|||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
def initialize(**options)
|
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 = options.transform_values { |v| Set.new(Kernel.Array(v)) }
|
||||||
conflicts.default = Set.new
|
conflicts.default = Set.new
|
||||||
|
Loading…
x
Reference in New Issue
Block a user