4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/validates_panamanian_taxpayer_registry/panamanian_taxpayer_registry_validator.rb', line 4
def validate_each(record, attribute, value)
rfc = ValidatesPanamanianTaxpayerRegistry::PanamanianTaxpayerRegistry.new(value)
return if rfc.valid?
ruby_prior_version_three =
Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.0.0')
if ruby_prior_version_three
record.errors.add(attribute, :invalid, options)
else
record.errors.add(attribute, :invalid, **options)
end
end
|