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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3a42ec155de4fb7b2a8ea675ac0380274f23b38795c0eb0e73c0efb3ed4d8a5
4
- data.tar.gz: aaec470245e26e61d277a329340833eef93fa22939395273eabba719f977408e
3
+ metadata.gz: 48fbcbb306ad72fdcbd33b68c46e1c3bc586d24a7ba931f8c4a059e22f65b3a7
4
+ data.tar.gz: cbdc2cadfa4c1438312de09177b2c54d476f68e5fc585248eeb046212d71025a
5
5
  SHA512:
6
- metadata.gz: 99128e918a87c4e875191b47177507da77be675aafb7a7bec430457ab420c4b5081872407b31d07de04fc24233e57d14e711a019f49939d3db89e757eeeab1a1
7
- data.tar.gz: a9676a2d17fd3a5e0d178159ed9b413ea73469790e5219040cfa80e5679fce578ac0e80e95b60366cdd23f4961744eba65740464e6bd05bb1549805547862b1f
6
+ metadata.gz: 0cb7432992d4c61aaa8ccb0774e48aad98a61a575555dc6e4d509560938fd4fb4267bd62d90cdd2f589d93ed1eb5ded12503fe213023f10972ed399ded5f863c
7
+ data.tar.gz: 4dd9e4ae33cde41d27e308fc1d5249cc7676274162ecc20d79e1088f029b6aab330bfe1dc424fb74515fbb42ab744c375fd60ef6078ad6c9ba6e315ca07a71f8
data/Gemfile CHANGED
@@ -17,4 +17,5 @@ gem 'rubocop', require: false
17
17
  group :bench do
18
18
  gem 'benchmark-ips'
19
19
  gem 'phonelib'
20
+ gem 'telephone_number'
20
21
  end
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
- Phonelib: valid?: 426.0 i/s
85
- MiniPhone: valid?: 34707.9 i/s - 81.47x faster
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
- Phonelib: e164: 580.3 i/s
89
- MiniPhone: e164: 43385.9 i/s - 74.76x faster
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 (raw_input == "") {
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
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MiniPhone
4
- VERSION = '1.1.5'
4
+ VERSION = '1.1.6'
5
5
  end
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.5
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 00:00:00.000000000 Z
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