Closed tricknotes closed 3 years ago
The keyword argument has been separated from last argument since Ruby 3. https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
I applied the following patch on my fork, then it seems working fine.
diff --git a/lib/validators/phone_validator.rb b/lib/validators/phone_validator.rb index 8957fbb..b683df5 100644 --- a/lib/validators/phone_validator.rb +++ b/lib/validators/phone_validator.rb @@ -62,7 +62,7 @@ class PhoneValidator < ActiveModel::EachValidator @phone = parse(value, specified_country(record)) valid = phone_valid? && valid_types? && valid_country? && valid_extensions? - record.errors.add(attribute, message, options) unless valid + record.errors.add(attribute, message, **options) unless valid end private
However, this patch breaks legacy Ruby versions at least 1.9. Do you want to support current supported versions that described in .travis.yml? https://github.com/daddyz/phonelib/blob/6f4aca63bbc3bab8e65c191a5b70dd1044831ee3/.travis.yml#L7-L13
.travis.yml
Currently, Ruby 2.5 or later are only maintained. https://www.ruby-lang.org/en/news/2020/04/05/support-of-ruby-2-4-has-ended/
If you agree with dropping legacy versions, I'll send a PR to support newer versions of Ruby including 3.
It seems Travis CI doesn't run on this repository...? Okay, I'll add CI to use GitHub Actions.
The keyword argument has been separated from last argument since Ruby 3. https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
I applied the following patch on my fork, then it seems working fine.
However, this patch breaks legacy Ruby versions at least 1.9. Do you want to support current supported versions that described in
.travis.yml
? https://github.com/daddyz/phonelib/blob/6f4aca63bbc3bab8e65c191a5b70dd1044831ee3/.travis.yml#L7-L13Currently, Ruby 2.5 or later are only maintained. https://www.ruby-lang.org/en/news/2020/04/05/support-of-ruby-2-4-has-ended/
If you agree with dropping legacy versions, I'll send a PR to support newer versions of Ruby including 3.