daddyz / phonelib

Ruby gem for phone validation and formatting using google libphonenumber library data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Changed bahavior upgrading from 0.8.0 to 0.8.1

tilo opened this issue · comments

commented

looks like the API for PhoneLib changed from version 0.8.0 to 0.8.1

before you could do this:

phone = Phonelib.parse(phone_number, ["US", "CA"])

now you have to do this:

phone = nil
phone ||= Phonelib.parse(phone_number, "US")
phone ||= Phonelib.parse(phone_number, "CA")
  • such a change in behavior should be caught by failing tests in PhoneLib
    -> there was no test coverage
  • any change in behavior should rev-up more than just the last digit of the version
    -> see https://semver.org/
commented

@daddyz did you see this?

@tilo interesting undocumented behavior. I never saw that method being used like that, it's not documented and not tested. I tried it locally on 0.8.9 and it works. Can you specify your ruby version?

commented

@tilo interesting undocumented behavior. I never saw that method being used like that, it's not documented and not tested. I tried it locally on 0.8.9 and it works. Can you specify your ruby version?

@daddyz we're using Ruby 3.2.2

@tilo can you test latest version?

regardless, there is a configuration option that allows several countries:

Phonelib.default_country = ['US', 'CA']
phone = Phonelib.parse(phone_number)

@tilo check version 0.9.1, I saw this happening for possible numbers only, with valid numbers it was working properly

commented

looks like our tests are passing with 0.9.1

great, closing the issue