lib/lite/validators/base_validator.rb in lite-validators-1.7.2 vs lib/lite/validators/base_validator.rb in lite-validators-1.8.0
- old
+ new
@@ -17,20 +17,18 @@
@record = record
@attribute = attribute
@value = value
end
- # rubocop:disable Layout/LineLength
def assert_valid_option!(name, collection, option: nil)
option ||= send(name)
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
- # rubocop:enable Layout/LineLength
def error_message
[options[:message] || :invalid]
end