mini_phone 1.1.5 → 1.1.6
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/README.md +8 -6
- data/ext/mini_phone/mini_phone.cc +7 -7
- data/lib/mini_phone/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48fbcbb306ad72fdcbd33b68c46e1c3bc586d24a7ba931f8c4a059e22f65b3a7
|
4
|
+
data.tar.gz: cbdc2cadfa4c1438312de09177b2c54d476f68e5fc585248eeb046212d71025a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cb7432992d4c61aaa8ccb0774e48aad98a61a575555dc6e4d509560938fd4fb4267bd62d90cdd2f589d93ed1eb5ded12503fe213023f10972ed399ded5f863c
|
7
|
+
data.tar.gz: 4dd9e4ae33cde41d27e308fc1d5249cc7676274162ecc20d79e1088f029b6aab330bfe1dc424fb74515fbb42ab744c375fd60ef6078ad6c9ba6e315ca07a71f8
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -77,16 +77,18 @@ an issue and we will try to support it.
|
|
77
77
|
On average, most methods are 40x to 50x faster than other libraries. To run
|
78
78
|
the benchmarks locally, execute: `bundle exec rake bench`
|
79
79
|
|
80
|
-
|
81
|
-
# Results from my Linux (5.10.6-arch1-10)
|
80
|
+
### Results from my Linux (5.10.6-arch1-10)
|
82
81
|
|
82
|
+
```
|
83
83
|
Comparison:
|
84
|
-
|
85
|
-
|
84
|
+
MiniPhone: valid?: 33382.0 i/s
|
85
|
+
Phonelib: valid?: 422.8 i/s - 78.95x (± 0.00) slower
|
86
|
+
TelephoneNumber: valid?: 164.3 i/s - 203.13x (± 0.00) slower
|
86
87
|
|
87
88
|
Comparison:
|
88
|
-
|
89
|
-
|
89
|
+
MiniPhone: e164: 41187.5 i/s
|
90
|
+
Phonelib: e164: 579.0 i/s - 71.14x (± 0.00) slower
|
91
|
+
TelephoneNumber: e164: 228.8 i/s - 179.99x (± 0.00) slower
|
90
92
|
```
|
91
93
|
|
92
94
|
## Installation
|
@@ -433,13 +433,14 @@ extern "C" VALUE rb_phone_number_to_s(VALUE self) {
|
|
433
433
|
PhoneNumberInfo *phone_number_info;
|
434
434
|
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
435
435
|
PhoneNumber *phone_number = phone_number_info->phone_number;
|
436
|
-
std::string raw_input = phone_number->raw_input();
|
437
436
|
|
438
|
-
if (
|
437
|
+
if (phone_number == NULL) {
|
439
438
|
return Qnil;
|
440
|
-
} else {
|
441
|
-
return rb_str_new(raw_input.c_str(), raw_input.size());
|
442
439
|
}
|
440
|
+
|
441
|
+
std::string raw_input = phone_number->raw_input();
|
442
|
+
|
443
|
+
return rb_str_new(raw_input.c_str(), raw_input.size());
|
443
444
|
}
|
444
445
|
|
445
446
|
static inline void setup_formats() {
|
@@ -517,10 +518,10 @@ extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
|
|
517
518
|
|
518
519
|
if (result != PhoneNumberUtil::NO_PARSING_ERROR) {
|
519
520
|
rb_phone_number_nullify_ivars(self);
|
520
|
-
} else {
|
521
|
-
phone_number_info->phone_number->Swap(&parsed_number);
|
522
521
|
}
|
523
522
|
|
523
|
+
phone_number_info->phone_number->Swap(&parsed_number);
|
524
|
+
|
524
525
|
return self;
|
525
526
|
}
|
526
527
|
|
@@ -577,6 +578,5 @@ extern "C" void Init_mini_phone(void) {
|
|
577
578
|
rb_define_method(rb_cPhoneNumber, "type", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_type), 0);
|
578
579
|
rb_define_method(rb_cPhoneNumber, "area_code", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_area_code), 0);
|
579
580
|
rb_define_method(rb_cPhoneNumber, "to_s", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_to_s), 0);
|
580
|
-
rb_define_method(rb_cPhoneNumber, "raw_input", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_to_s), 0);
|
581
581
|
rb_define_method(rb_cPhoneNumber, "==", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_match_eh), 1);
|
582
582
|
}
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Ker-Seymer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-18 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.
|
@@ -43,7 +43,7 @@ metadata:
|
|
43
43
|
homepage_uri: https://github.com/ianks/mini_phone
|
44
44
|
source_code_uri: https://github.com/ianks/mini_phone
|
45
45
|
changelog_uri: https://github.com/ianks/mini_phone/blob/master/CHANGELOG.md
|
46
|
-
post_install_message:
|
46
|
+
post_install_message:
|
47
47
|
rdoc_options: []
|
48
48
|
require_paths:
|
49
49
|
- lib
|
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
61
|
rubygems_version: 3.1.4
|
62
|
-
signing_key:
|
62
|
+
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Uses the Google libphonenumber C lib to parse, validate, and format phone
|
65
65
|
numbers
|