mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 11:38:30 +02:00
Use match? instead of match
for regex where MatchData is unused
This commit is contained in:
parent
db08ad7125
commit
82dbd3e8b8
7 changed files with 12 additions and 10 deletions
|
@ -10,7 +10,9 @@ class Contact::Ident::RegNoValidator < ActiveModel::EachValidator
|
|||
|
||||
return unless format
|
||||
|
||||
record.errors.add(attribute, :invalid_reg_no, country: record.country) unless value =~ format
|
||||
unless value.match?(format)
|
||||
record.errors.add(attribute, :invalid_reg_no, country: record.country)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -22,7 +22,7 @@ class DomainNameValidator < ActiveModel::EachValidator
|
|||
# it's punycode
|
||||
if value[2] == '-' && value[3] == '-'
|
||||
regexp = /\Axn--[a-zA-Z0-9-]{0,59}\.#{general_domains}\z/
|
||||
return false unless value =~ regexp
|
||||
return false unless value.match?(regexp)
|
||||
value = SimpleIDN.to_unicode(value).mb_chars.downcase.strip
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue