lib/lite/validators/base_validator.rb in lite-validators-1.0.7 vs lib/lite/validators/base_validator.rb in lite-validators-1.1.0
- old
+ new
@@ -21,10 +21,10 @@
# rubocop:disable Layout/LineLength
def assert_valid_option!(name, collection, option: nil)
option ||= send(name)
- [*option].each do |option_value|
+ Array(option).each do |option_value|
next if collection.include?(option_value)
raise ArgumentError, "Unknown #{name}: #{option_value.inspect}. Valid options are: #{collection.map(&:inspect).join(', ')}"
end
end