phonelib 0.10.26 → 0.10.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e167c9f5d91a48e5bd9b336f41f95da24b5d147b2a2c5fc22ce9c860e7c105e7
4
- data.tar.gz: db640f3955e5c5d4fd907bb25d3c4fa1c0bbb783a5245a5515366e4721e01994
3
+ metadata.gz: f83c41ac447eda86a265db83bf280bac4a0dcb63c047709c87ed595befedfd6f
4
+ data.tar.gz: f35bd84877a5999e637f74b037ce2e27b9219cde1a947ef5934266894edafd02
5
5
  SHA512:
6
- metadata.gz: 81acdf0374d5fb09daa882cb27ec95f79f39bab2ea8539c67f55aca156eb2516ddaa29d6757cc38ce8860feef5aa74654be96cbdc1c83cc000002495195250e8
7
- data.tar.gz: 7080901f2d6d0a235f76fc9f1094775190f32e7036b336e1c719f5b2fc1b8412c66d9edea4fa357863a04f916d5c86b20489b2ab36cd3c9b1d2ea35677784fcb
6
+ metadata.gz: f7bd1ea50bbd2a2b7c51999c7d79e95e2ca68642883e3909babd92508471b3d4dad68499e74b0aac30bcf8d97df1e9111e241e9746041a469e311e76dea4b6d8
7
+ data.tar.gz: '0593f5cf2fabf0109b59a788757fd8eb81a6860ffb73519ba24303f4d19c30bfc6a7830ee3d264a82f12468652e5a05abc43f8aaf8d1513f911578c385ef7ef1'
data/README.md CHANGED
@@ -154,13 +154,6 @@ if mixed with <tt>possible</tt> will check if number is possible for specified c
154
154
 
155
155
  <tt>extensions: false</tt> - set to perform check for phone extension to be blank
156
156
 
157
- <<<<<<< HEAD
158
- <tt>require_international_prefix: true</tt> - requires the original value to use <tt>+</tt> or <tt>00</tt> as its explicit international marker. The marker may follow leading formatting characters recognized by the parser. This option does not change the parser or the formatted output.
159
-
160
- <tt>format: :e164</tt> - requires the original value to match Phonelib's canonical <tt>+</tt>-prefixed E.164 representation: 2 to 15 total ASCII digits, beginning with 1-9, with no spaces, punctuation, or extension. Unsupported formats raise an <tt>ArgumentError</tt> when the validator is configured.
161
-
162
- ||||||| ec5e850
163
- =======
164
157
  <tt>require_international_prefix: true</tt> - requires the original value to use <tt>+</tt> or <tt>00</tt> as its explicit international marker. The marker may follow leading formatting characters recognized by the parser. This option does not change the parser or the formatted output.
165
158
 
166
159
  <tt>format: :e164</tt> - requires the original value to match Phonelib's canonical <tt>+</tt>-prefixed E.164 representation: 2 to 15 total ASCII digits, beginning with 1-9, with no spaces, punctuation, or extension. Unsupported formats raise an <tt>ArgumentError</tt> when the validator is configured.
@@ -206,7 +199,6 @@ es:
206
199
  phone_invalid: "no es un número telefónico válido"
207
200
  ```
208
201
 
209
- >>>>>>> salasebas-salasebas/structured-validation-errors
210
202
  ### Basic usage
211
203
 
212
204
  To check if phone number is valid simply run:
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Phonelib
4
4
  # @private
5
- VERSION = '0.10.26'
5
+ VERSION = '0.10.27'
6
6
  end
@@ -96,7 +96,8 @@ class PhoneValidator < ActiveModel::EachValidator
96
96
  end
97
97
 
98
98
  valid = phone_valid?(phone) && valid_types?(phone) && valid_country?(phone) &&
99
- valid_extensions?(phone) && valid_input_format?(value)
99
+ valid_extensions?(phone) && valid_international_prefix?(phone) &&
100
+ valid_input_format?(value)
100
101
  record.errors.add(attribute, message, **legacy_error_options) unless valid
101
102
  end
102
103
 
@@ -174,10 +175,10 @@ class PhoneValidator < ActiveModel::EachValidator
174
175
  !options.has_key?(:extensions) || !!options[:extensions]
175
176
  end
176
177
 
177
- def valid_international_prefix?
178
+ def valid_international_prefix?(phone)
178
179
  return true unless options[:require_international_prefix]
179
180
 
180
- @phone.explicit_international_prefix?
181
+ phone.explicit_international_prefix?
181
182
  end
182
183
 
183
184
  def valid_input_format?(value)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phonelib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.26
4
+ version: 0.10.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Senderovich
@@ -46,7 +46,7 @@ homepage: https://github.com/daddyz/phonelib
46
46
  licenses:
47
47
  - MIT
48
48
  metadata:
49
- changelog_uri: https://github.com/daddyz/phonelib/releases/tag/v0.10.26
49
+ changelog_uri: https://github.com/daddyz/phonelib/releases/tag/v0.10.27
50
50
  post_install_message:
51
51
  rdoc_options:
52
52
  - " --no-private - CHANGELOG.md --readme README.md"