mini_phone 1.1.1 → 1.1.2
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 +4 -4
- data/Gemfile +1 -0
- data/ext/mini_phone/mini_phone.cc +16 -8
- data/lib/mini_phone/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45a73dd6dde16c5baff08c0d9cf225e4bb53ae15b8b040559e4555180070e8d1
|
4
|
+
data.tar.gz: cbb196644cb95f7cf3a46648c176e22845708f5e3bab14256a8d80832e187175
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b95b0e2e18d15b7cf7c17e901a85d0b42f2e5fd6d9947f6d0e63a97197c86b39ce8f6341669e67ab69a07a6356b336f3cf4659a328a9c603a6d03856ac7c325b
|
7
|
+
data.tar.gz: 5db0ebb434cd3d427ae511e2a3e8bad13bcc7520c1147e1d7a8fafbf06c3213ae8521b30234b7691d0f06f634e0a503912bf638820f7dd37750ea12838944cf3
|
data/Gemfile
CHANGED
@@ -8,6 +8,7 @@ gemspec
|
|
8
8
|
gem 'rake', require: false
|
9
9
|
# https://github.com/rake-compiler/rake-compiler/pull/166
|
10
10
|
gem 'get_process_mem', require: false
|
11
|
+
gem 'pry', require: false
|
11
12
|
gem 'rake-compiler', github: 'larskanis/rake-compiler', branch: 'fix-native-version'
|
12
13
|
gem 'rspec', '~> 3.0', require: false
|
13
14
|
gem 'rspec-github', require: false
|
@@ -376,20 +376,28 @@ extern "C" VALUE rb_phone_number_region_code(VALUE self) {
|
|
376
376
|
return rb_iv_set(self, "@region_code", result);
|
377
377
|
}
|
378
378
|
|
379
|
-
extern "C" VALUE
|
380
|
-
if (!
|
379
|
+
extern "C" VALUE rb_phone_number_match_eh(VALUE self, VALUE other) {
|
380
|
+
if (!rb_obj_is_kind_of(other, rb_cPhoneNumber)) {
|
381
381
|
return Qfalse;
|
382
382
|
}
|
383
383
|
|
384
|
+
VALUE self_input = rb_iv_get(self, "@input");
|
385
|
+
VALUE other_input = rb_iv_get(other, "@input");
|
386
|
+
|
387
|
+
// If inputs are the exact same, the result is as well
|
388
|
+
if (rb_eql(self_input, other_input)) {
|
389
|
+
return Qtrue;
|
390
|
+
}
|
391
|
+
|
384
392
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
385
393
|
|
386
|
-
PhoneNumberInfo *
|
387
|
-
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type,
|
394
|
+
PhoneNumberInfo *self_info;
|
395
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, self_info);
|
388
396
|
|
389
|
-
PhoneNumberInfo *
|
390
|
-
TypedData_Get_Struct(other, PhoneNumberInfo, &phone_number_info_type,
|
397
|
+
PhoneNumberInfo *other_info;
|
398
|
+
TypedData_Get_Struct(other, PhoneNumberInfo, &phone_number_info_type, other_info);
|
391
399
|
|
392
|
-
if (phone_util.IsNumberMatch(*
|
400
|
+
if (phone_util.IsNumberMatch(*other_info->phone_number, *self_info->phone_number) == PhoneNumberUtil::EXACT_MATCH) {
|
393
401
|
return Qtrue;
|
394
402
|
} else {
|
395
403
|
return Qfalse;
|
@@ -547,5 +555,5 @@ extern "C" void Init_mini_phone(void) {
|
|
547
555
|
rb_define_method(rb_cPhoneNumber, "type", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_type), 0);
|
548
556
|
rb_define_method(rb_cPhoneNumber, "area_code", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_area_code), 0);
|
549
557
|
rb_define_method(rb_cPhoneNumber, "to_s", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_to_s), 0);
|
550
|
-
rb_define_method(rb_cPhoneNumber, "
|
558
|
+
rb_define_method(rb_cPhoneNumber, "==", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_match_eh), 1);
|
551
559
|
}
|
data/lib/mini_phone/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_phone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Ker-Seymer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Plugs directly in the the Google's native C++ [libphonenumber](https://github.com/google/libphonenumber)
|
14
14
|
for extemely _fast_ and _robust_ phone number parsing, validation, and formatting.
|