mini_phone 1.0.6 → 1.1.4

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: 4f7c87533de0643b9af5d9394d62a238208c34fa34e16effbb9064e9fd3578d7
4
- data.tar.gz: 5868d8b76184925da0ba875fa0a5df7c3bb61f920b51f5d9391fd2d742335ddc
3
+ metadata.gz: 8267c89cf237c4baf3e8dfe8718e0c0fe453b4919f6e38d00dc70cc557ed8cf0
4
+ data.tar.gz: 2b537745421bbb9fe70000c3707c6f20c052f0770fd156ac4d915bb92e33c736
5
5
  SHA512:
6
- metadata.gz: 6bdb02eee2405855e49defd3e27d9eccd8934ec1bc1c02977b69d17026d32500969b443b053b1eece4ca7f72294a2d57349c19cfe14f6993c02dab6d21ec9d21
7
- data.tar.gz: e57f59c8c2b75a1e4983d8a7fc3941fa1c641bd1c55eb13185bc9c8b35347b39a3ce301e65e021887f5bfc403ee8b0b5e5bad60d20e3604900418c0b6d46511e
6
+ metadata.gz: 0db1af779c2b9564dedc09eee290359b5d3bb53bfb8e53180b1d56225cd054d1bddc37b87ff7da794cc2686c04ccbfcaed0285cebea170e4f5b5f594ee841091
7
+ data.tar.gz: 9e94872e27a229014cc754fe349e5d9f536baef87e26aee5b6bd9205604c553fcd392fa8ec4c658f9e5fedb0f958217e3b839337559200cded15b36442f2ab45
data/Dockerfile.dev ADDED
@@ -0,0 +1,9 @@
1
+ FROM ruby:2.7-alpine
2
+
3
+ WORKDiR /app
4
+
5
+ # RUN apt-get update -y && apt-get install -y valgrind libphonenumber
6
+ RUN apk add --no-cache libphonenumber-dev valgrind git make libffi-dev build-base
7
+ COPY Gemfile Gemfile.lock mini_phone.gemspec ./
8
+ COPY lib/mini_phone/version.rb ./lib/mini_phone/version.rb
9
+ RUN bundle install -j4
data/Gemfile CHANGED
@@ -7,6 +7,8 @@ gemspec
7
7
 
8
8
  gem 'rake', require: false
9
9
  # https://github.com/rake-compiler/rake-compiler/pull/166
10
+ gem 'get_process_mem', require: false
11
+ gem 'pry', require: false
10
12
  gem 'rake-compiler', github: 'larskanis/rake-compiler', branch: 'fix-native-version'
11
13
  gem 'rspec', '~> 3.0', require: false
12
14
  gem 'rspec-github', require: false
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A Ruby gem which plugs directly into Google's native C++
4
4
  [libphonenumber](https://github.com/google/libphonenumber) for extremely
5
5
  _fast_ and _robust_ phone number parsing, validation, and formatting. On
6
- average, most methods are 40x to 50x faster than other Ruby phone number
6
+ average, most methods are 70x to 80x faster than other Ruby phone number
7
7
  libraries.
8
8
 
9
9
  ## Usage
@@ -78,15 +78,15 @@ 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
80
  ```
81
+ # Results from my Linux (5.10.6-arch1-10)
82
+
81
83
  Comparison:
82
- MiniPhone: valid?: 23111.4 i/s
83
- Phonelib: valid?: 482.3 i/s - 47.92x (± 0.00) slower
84
- ```
84
+ Phonelib: valid?: 426.0 i/s
85
+ MiniPhone: valid?: 34707.9 i/s - 81.47x faster
85
86
 
86
- ```
87
87
  Comparison:
88
- MiniPhone: e164: 31567.0 i/s
89
- Phonelib: e164: 652.3 i/s - 48.39x (± 0.00) slower
88
+ Phonelib: e164: 580.3 i/s
89
+ MiniPhone: e164: 43385.9 i/s - 74.76x faster
90
90
  ```
91
91
 
92
92
  ## Installation
@@ -98,7 +98,7 @@ Comparison:
98
98
  ```
99
99
 
100
100
  ```sh
101
- apt-get install -y libphonenumber # debian / ubuntu
101
+ apt-get install -y libphonenumber-dev # debian / ubuntu
102
102
  ```
103
103
 
104
104
  2. Add this line to your application's Gemfile:
data/Rakefile CHANGED
@@ -76,3 +76,21 @@ namespace :publish do
76
76
  push_to_github_registry(g)
77
77
  end
78
78
  end
79
+
80
+ desc 'Run valgrind test'
81
+
82
+ namespace :debug do
83
+ desc 'Plot memory'
84
+ task :memory do
85
+ sh 'debug/memory_plot/plot.sh'
86
+ end
87
+
88
+ task :valgrind do
89
+ sh 'docker build --tag mini_phone_dev -f Dockerfile.dev .'
90
+ args = '--tool=memcheck --num-callers=15 --partial-loads-ok=yes --undef-value-errors=no'
91
+ script = 'ruby debug/memory_plot/memory.rb --once'
92
+ cmd = "docker run -it --rm -v #{Dir.pwd}:/app -w /app mini_phone_dev valgrind #{args} #{script}"
93
+ puts cmd
94
+ system cmd
95
+ end
96
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+ require 'mini_phone'
5
+ require 'get_process_mem'
6
+
7
+ 10.times do
8
+ GC.start
9
+ GC.compact
10
+ end
11
+
12
+ $stdout.sync = true
13
+
14
+ loop do
15
+ 10_000.times do
16
+ pn = MiniPhone::PhoneNumber.new('+1 404 388 1299')
17
+ pn.e164
18
+ pn.valid?
19
+ pn.possible?
20
+ pn.raw_national
21
+ pn.international
22
+ pn.country_code
23
+ pn.area_code
24
+ end
25
+
26
+ 4.times { GC.start }
27
+
28
+ memory_mb = GetProcessMem.new.mb
29
+
30
+ $stdout.puts memory_mb
31
+
32
+ break if ARGV.first == '--once'
33
+ end
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+
5
+ bundle exec rake compile
6
+ exec ruby "$(dirname "$0")/memory.rb" | ttyplot
@@ -20,7 +20,7 @@ unless have_library('phonenumber')
20
20
  | brew install libphonenumber |
21
21
  | |
22
22
  | On Debian / Ubuntu: |
23
- | apt-get install -y libphonenumber |
23
+ | apt-get install -y libphonenumber-dev |
24
24
  | |
25
25
  | 2. Retry installing the gem (i.e `bundle install`) |
26
26
  | |
@@ -14,10 +14,29 @@ static VALUE rb_cPhoneNumber;
14
14
  static RepeatedPtrField<NumberFormat> raw_national_format;
15
15
  static RepeatedPtrField<NumberFormat> dasherized_national_format;
16
16
 
17
- extern "C" struct PhoneNumberInfo {
18
- PhoneNumber phone_number;
19
- std::string raw_phone_number;
20
- std::string raw_country_code;
17
+ extern "C" struct PhoneNumberInfo { PhoneNumber *phone_number; };
18
+
19
+ extern "C" size_t phone_number_info_size(const void *data) { return sizeof(PhoneNumberInfo) + sizeof(PhoneNumber); }
20
+
21
+ extern "C" void phone_number_info_free(void *data) {
22
+ PhoneNumberInfo *phone_number_info = static_cast<PhoneNumberInfo *>(data);
23
+ phone_number_info->phone_number->~PhoneNumber();
24
+ xfree(phone_number_info->phone_number);
25
+ phone_number_info->~PhoneNumberInfo();
26
+ xfree(data);
27
+ }
28
+
29
+ extern "C" const rb_data_type_t phone_number_info_type = {
30
+ .wrap_struct_name = "MiniPhone/PhoneNumberInfo",
31
+ .function =
32
+ {
33
+ .dmark = NULL,
34
+ .dfree = phone_number_info_free,
35
+ .dsize = phone_number_info_size,
36
+ },
37
+ .parent = NULL,
38
+ .data = NULL,
39
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
21
40
  };
22
41
 
23
42
  static inline VALUE is_phone_number_valid(VALUE self, VALUE str, VALUE cc) {
@@ -33,7 +52,13 @@ static inline VALUE is_phone_number_valid(VALUE self, VALUE str, VALUE cc) {
33
52
 
34
53
  auto result = phone_util.ParseAndKeepRawInput(phone_number, country_code, &parsed_number);
35
54
 
36
- if (result == PhoneNumberUtil::NO_PARSING_ERROR && phone_util.IsValidNumber(parsed_number)) {
55
+ if (result != PhoneNumberUtil::NO_PARSING_ERROR) {
56
+ return Qfalse;
57
+ }
58
+
59
+ if (country_code == "ZZ" && phone_util.IsValidNumber(parsed_number)) {
60
+ return Qtrue;
61
+ } else if (phone_util.IsValidNumberForRegion(parsed_number, country_code)) {
37
62
  return Qtrue;
38
63
  } else {
39
64
  return Qfalse;
@@ -107,17 +132,18 @@ extern "C" VALUE rb_set_default_country(VALUE self, VALUE str_code) {
107
132
 
108
133
  extern "C" VALUE rb_get_default_country(VALUE self) { return rb_iv_get(self, "@default_country"); }
109
134
 
110
- extern "C" void rb_phone_number_dealloc(PhoneNumberInfo *phone_number_info) { delete phone_number_info; }
111
-
112
135
  extern "C" VALUE rb_phone_number_parse(int argc, VALUE *argv, VALUE self) {
113
136
  return rb_class_new_instance(argc, argv, rb_cPhoneNumber);
114
137
  }
115
138
 
116
139
  extern "C" VALUE rb_phone_number_alloc(VALUE self) {
117
- PhoneNumberInfo *phone_number_info = new PhoneNumberInfo();
140
+ void *phone_number_data = ALLOC(PhoneNumber);
141
+ void *data = ALLOC(PhoneNumberInfo);
142
+ PhoneNumberInfo *phone_number_info = new (data) PhoneNumberInfo();
143
+ PhoneNumber *phone_number = new (phone_number_data) PhoneNumber();
144
+ phone_number_info->phone_number = phone_number;
118
145
 
119
- /* wrap */
120
- return Data_Wrap_Struct(self, NULL, &rb_phone_number_dealloc, phone_number_info);
146
+ return TypedData_Wrap_Struct(self, &phone_number_info_type, phone_number_info);
121
147
  }
122
148
 
123
149
  static inline VALUE rb_phone_number_nullify_ivars(VALUE self) {
@@ -139,53 +165,14 @@ static inline VALUE rb_phone_number_nullify_ivars(VALUE self) {
139
165
  return Qtrue;
140
166
  }
141
167
 
142
- extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
143
- VALUE str;
144
- VALUE def_cc;
145
-
146
- rb_scan_args(argc, argv, "11", &str, &def_cc);
147
-
148
- if (NIL_P(def_cc)) {
149
- def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
150
- }
151
-
152
- rb_iv_set(self, "@input", str);
153
-
154
- if (FIXNUM_P(str)) {
155
- str = rb_fix2str(str, 10);
156
- } else if (!RB_TYPE_P(str, T_STRING)) {
157
- return rb_phone_number_nullify_ivars(self);
158
- }
159
-
160
- PhoneNumberInfo *phone_number_info;
161
- PhoneNumber parsed_number;
162
-
163
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
164
-
165
- const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
166
-
167
- std::string phone_number(RSTRING_PTR(str), RSTRING_LEN(str));
168
- std::string country_code(RSTRING_PTR(def_cc), RSTRING_LEN(def_cc));
169
-
170
- auto result = phone_util.Parse(phone_number, country_code, &parsed_number);
171
-
172
- if (result != PhoneNumberUtil::NO_PARSING_ERROR) {
173
- rb_phone_number_nullify_ivars(self);
174
- } else {
175
- phone_number_info->phone_number = parsed_number;
176
- }
177
-
178
- return self;
179
- }
180
-
181
168
  static inline VALUE rb_phone_number_format(VALUE self, PhoneNumberUtil::PhoneNumberFormat fmt) {
182
169
  std::string formatted_number;
183
170
  PhoneNumberInfo *phone_number_info;
184
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
171
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
185
172
 
186
173
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
187
- PhoneNumber parsed_number = phone_number_info->phone_number;
188
- phone_util.Format(parsed_number, fmt, &formatted_number);
174
+ PhoneNumber *parsed_number = phone_number_info->phone_number;
175
+ phone_util.Format(*parsed_number, fmt, &formatted_number);
189
176
 
190
177
  return rb_str_new(formatted_number.c_str(), formatted_number.size());
191
178
  }
@@ -227,9 +214,9 @@ VALUE format_by_pattern_national(VALUE self, RepeatedPtrField<NumberFormat> form
227
214
  std::string formatted_number;
228
215
  PhoneNumberInfo *phone_number_info;
229
216
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
230
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
217
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
231
218
 
232
- phone_util.FormatByPattern(phone_number_info->phone_number, PhoneNumberUtil::NATIONAL, format, &formatted_number);
219
+ phone_util.FormatByPattern(*phone_number_info->phone_number, PhoneNumberUtil::NATIONAL, format, &formatted_number);
233
220
 
234
221
  return rb_str_new(formatted_number.c_str(), formatted_number.size());
235
222
  }
@@ -260,9 +247,9 @@ extern "C" VALUE rb_phone_number_country_code(VALUE self) {
260
247
  }
261
248
 
262
249
  PhoneNumberInfo *phone_number_info;
263
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
250
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
264
251
 
265
- int code = phone_number_info->phone_number.country_code();
252
+ int code = phone_number_info->phone_number->country_code();
266
253
 
267
254
  VALUE result = INT2NUM(code);
268
255
 
@@ -302,11 +289,11 @@ extern "C" VALUE rb_phone_number_valid_eh(VALUE self) {
302
289
 
303
290
  std::string formatted_number;
304
291
  PhoneNumberInfo *phone_number_info;
305
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
292
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
306
293
 
307
294
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
308
295
 
309
- if (phone_util.IsValidNumber(phone_number_info->phone_number)) {
296
+ if (phone_util.IsValidNumber(*phone_number_info->phone_number)) {
310
297
  return rb_iv_set(self, "@valid", Qtrue);
311
298
  } else {
312
299
  return rb_iv_set(self, "@valid", Qfalse);
@@ -324,11 +311,11 @@ extern "C" VALUE rb_phone_number_possible_eh(VALUE self) {
324
311
 
325
312
  std::string formatted_number;
326
313
  PhoneNumberInfo *phone_number_info;
327
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
314
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
328
315
 
329
316
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
330
317
 
331
- if (phone_util.IsPossibleNumber(phone_number_info->phone_number)) {
318
+ if (phone_util.IsPossibleNumber(*phone_number_info->phone_number)) {
332
319
  return rb_iv_set(self, "@possible", Qtrue);
333
320
  } else {
334
321
  return rb_iv_set(self, "@possible", Qfalse);
@@ -346,29 +333,38 @@ extern "C" VALUE rb_phone_number_region_code(VALUE self) {
346
333
 
347
334
  PhoneNumberInfo *phone_number_info;
348
335
  std::string code;
349
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
336
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
350
337
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
351
338
 
352
- phone_util.GetRegionCodeForCountryCode(phone_number_info->phone_number.country_code(), &code);
339
+ phone_util.GetRegionCodeForCountryCode(phone_number_info->phone_number->country_code(), &code);
353
340
 
354
341
  VALUE result = rb_str_new(code.c_str(), code.size());
355
342
 
356
343
  return rb_iv_set(self, "@region_code", result);
357
344
  }
358
345
 
359
- extern "C" VALUE rb_phone_number_eql_eh(VALUE self, VALUE other) {
360
- if (!rb_obj_is_instance_of(other, rb_cPhoneNumber)) {
346
+ extern "C" VALUE rb_phone_number_match_eh(VALUE self, VALUE other) {
347
+ if (!rb_obj_is_kind_of(other, rb_cPhoneNumber)) {
361
348
  return Qfalse;
362
349
  }
363
350
 
351
+ VALUE self_input = rb_iv_get(self, "@input");
352
+ VALUE other_input = rb_iv_get(other, "@input");
353
+
354
+ // If inputs are the exact same, the result is as well
355
+ if (rb_eql(self_input, other_input)) {
356
+ return Qtrue;
357
+ }
358
+
364
359
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
365
360
 
366
- PhoneNumberInfo *self_phone_number_info;
367
- Data_Get_Struct(self, PhoneNumberInfo, self_phone_number_info);
361
+ PhoneNumberInfo *self_info;
362
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, self_info);
363
+
364
+ PhoneNumberInfo *other_info;
365
+ TypedData_Get_Struct(other, PhoneNumberInfo, &phone_number_info_type, other_info);
368
366
 
369
- PhoneNumberInfo *other_phone_number_info;
370
- Data_Get_Struct(other, PhoneNumberInfo, other_phone_number_info);
371
- if (phone_util.IsNumberMatch(other_phone_number_info->phone_number, self_phone_number_info->phone_number)) {
367
+ if (phone_util.IsNumberMatch(*other_info->phone_number, *self_info->phone_number) == PhoneNumberUtil::EXACT_MATCH) {
372
368
  return Qtrue;
373
369
  } else {
374
370
  return Qfalse;
@@ -381,14 +377,14 @@ extern "C" VALUE rb_phone_number_type(VALUE self) {
381
377
  }
382
378
 
383
379
  PhoneNumberInfo *phone_number_info;
384
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
380
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
385
381
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
386
382
 
387
383
  VALUE result;
388
384
 
389
385
  // @see
390
386
  // https://github.com/google/libphonenumber/blob/4e9954edea7cf263532c5dd3861a801104c3f012/cpp/src/phonenumbers/phonenumberutil.h#L91
391
- switch (phone_util.GetNumberType(phone_number_info->phone_number)) {
387
+ switch (phone_util.GetNumberType(*phone_number_info->phone_number)) {
392
388
  case PhoneNumberUtil::PREMIUM_RATE:
393
389
  result = rb_intern("premium_rate");
394
390
  break;
@@ -437,15 +433,15 @@ extern "C" VALUE rb_phone_number_area_code(VALUE self) {
437
433
 
438
434
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
439
435
  PhoneNumberInfo *phone_number_info;
440
- Data_Get_Struct(self, PhoneNumberInfo, phone_number_info);
436
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
441
437
 
442
- PhoneNumber number = phone_number_info->phone_number;
438
+ PhoneNumber *number = phone_number_info->phone_number;
443
439
  string national_significant_number;
444
- phone_util.GetNationalSignificantNumber(number, &national_significant_number);
440
+ phone_util.GetNationalSignificantNumber(*number, &national_significant_number);
445
441
  string area_code;
446
442
  string subscriber_number;
447
443
 
448
- int area_code_length = phone_util.GetLengthOfGeographicalAreaCode(number);
444
+ int area_code_length = phone_util.GetLengthOfGeographicalAreaCode(*number);
449
445
  if (area_code_length > 0) {
450
446
  area_code = national_significant_number.substr(0, area_code_length);
451
447
  subscriber_number = national_significant_number.substr(area_code_length, string::npos);
@@ -459,6 +455,8 @@ extern "C" VALUE rb_phone_number_area_code(VALUE self) {
459
455
  return rb_iv_set(self, "@area_code", result);
460
456
  }
461
457
 
458
+ extern "C" VALUE rb_phone_number_to_s(VALUE self) { return rb_iv_get(self, "@input"); }
459
+
462
460
  static inline void setup_formats() {
463
461
  // Raw
464
462
  NumberFormat *raw_fmt = raw_national_format.Add();
@@ -471,6 +469,49 @@ static inline void setup_formats() {
471
469
  dsh_fmt->set_format("$1-$2-$3");
472
470
  }
473
471
 
472
+ extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
473
+ VALUE str;
474
+ VALUE def_cc;
475
+
476
+ rb_scan_args(argc, argv, "11", &str, &def_cc);
477
+
478
+ if (NIL_P(def_cc)) {
479
+ def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
480
+ }
481
+
482
+ rb_iv_set(self, "@input", str);
483
+
484
+ if (FIXNUM_P(str)) {
485
+ str = rb_fix2str(str, 10);
486
+ } else if (!RB_TYPE_P(str, T_STRING)) {
487
+ return rb_phone_number_nullify_ivars(self);
488
+ }
489
+
490
+ PhoneNumberInfo *phone_number_info;
491
+ PhoneNumber parsed_number;
492
+
493
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
494
+
495
+ const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
496
+
497
+ std::string phone_number(RSTRING_PTR(str), RSTRING_LEN(str));
498
+ std::string country_code(RSTRING_PTR(def_cc), RSTRING_LEN(def_cc));
499
+
500
+ auto result = phone_util.Parse(phone_number, country_code, &parsed_number);
501
+
502
+ if (result != PhoneNumberUtil::NO_PARSING_ERROR) {
503
+ rb_phone_number_nullify_ivars(self);
504
+ } else {
505
+ phone_number_info->phone_number->Swap(&parsed_number);
506
+ }
507
+
508
+ if (country_code != "ZZ" && !rb_str_equal(rb_phone_number_region_code(self), def_cc)) {
509
+ rb_phone_number_nullify_ivars(self);
510
+ }
511
+
512
+ return self;
513
+ }
514
+
474
515
  extern "C" void Init_mini_phone(void) {
475
516
  setup_formats();
476
517
 
@@ -523,5 +564,6 @@ extern "C" void Init_mini_phone(void) {
523
564
  rb_define_method(rb_cPhoneNumber, "country_code", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_country_code), 0);
524
565
  rb_define_method(rb_cPhoneNumber, "type", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_type), 0);
525
566
  rb_define_method(rb_cPhoneNumber, "area_code", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_area_code), 0);
526
- rb_define_method(rb_cPhoneNumber, "eql?", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_eql_eh), 1);
567
+ rb_define_method(rb_cPhoneNumber, "to_s", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_to_s), 0);
568
+ rb_define_method(rb_cPhoneNumber, "==", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_match_eh), 1);
527
569
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MiniPhone
4
- VERSION = '1.0.6'
4
+ VERSION = '1.1.4'
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.0.6
4
+ version: 1.1.4
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 00:00:00.000000000 Z
11
+ date: 2021-02-11 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.
@@ -22,10 +22,13 @@ extra_rdoc_files: []
22
22
  files:
23
23
  - CHANGELOG.md
24
24
  - CODE_OF_CONDUCT.md
25
+ - Dockerfile.dev
25
26
  - Gemfile
26
27
  - LICENSE.txt
27
28
  - README.md
28
29
  - Rakefile
30
+ - debug/memory_plot/memory.rb
31
+ - debug/memory_plot/plot.sh
29
32
  - ext/mini_phone/extconf.rb
30
33
  - ext/mini_phone/mini_phone.cc
31
34
  - ext/mini_phone/mini_phone.h