lib/tapioca/helpers/config_helper.rb in tapioca-0.9.4 vs lib/tapioca/helpers/config_helper.rb in tapioca-0.10.0
- old
+ new
@@ -98,11 +98,11 @@
config_key: String,
config_options: T::Hash[T.untyped, T.untyped]
).returns(T::Array[ConfigError])
end
def validate_config_options(command_options, config_key, config_options)
- config_options.map do |config_option_key, config_option_value|
+ config_options.filter_map do |config_option_key, config_option_value|
command_option = command_options[config_option_key.to_sym]
error_msg = "unknown option `#{config_option_key}` for key `#{config_key}`"
next build_error(error_msg) unless command_option
config_option_value_type = case config_option_value
@@ -133,10 +133,10 @@
error_msg = "invalid value for option `#{config_option_key}` for key `#{config_key}` - expected " \
"`Hash[String, String]` but found `#{config_option_value}`"
all_strings = (config_option_value.keys + config_option_value.values).all? { |v| v.is_a?(String) }
next build_error(error_msg) unless all_strings
end
- end.compact
+ end
end
class ConfigErrorMessagePart < T::Struct
const :message, String
const :colors, T::Array[Symbol]