mini_phone 1.0.5 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile.dev +9 -0
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/Rakefile +18 -0
- data/debug/memory_plot/memory.rb +33 -0
- data/debug/memory_plot/plot.sh +6 -0
- data/ext/mini_phone/extconf.rb +1 -1
- data/ext/mini_phone/mini_phone.cc +113 -49
- data/lib/mini_phone/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2296363b27632d0846ce32acc99c60a16e12f1670fc1aa6e2e5f6430505701e
|
4
|
+
data.tar.gz: 2c251bbabbec98c9a87e003dad1464a8cb7310d312ca7902791236a1b963f58e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9e80a337c5dc554d13e512f43f097de370c32f623d9d4ec6a4ccf0149352ab0ef726a5ac3e8155873f4bc67b9ebe054d0d935833dcc60a33c72171c7d2ed962
|
7
|
+
data.tar.gz: edbf05d8f841b3fcb144714958dc219134d35615f3d1eff5365affb9d94a6d7aa28e8419189179c4d10f84a57d201badb4147442f05070d42f7ed4779c82dbce
|
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
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
|
data/ext/mini_phone/extconf.rb
CHANGED
@@ -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
|
-
|
19
|
-
|
20
|
-
|
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) {
|
@@ -107,17 +126,18 @@ extern "C" VALUE rb_set_default_country(VALUE self, VALUE str_code) {
|
|
107
126
|
|
108
127
|
extern "C" VALUE rb_get_default_country(VALUE self) { return rb_iv_get(self, "@default_country"); }
|
109
128
|
|
110
|
-
extern "C" void rb_phone_number_dealloc(PhoneNumberInfo *phone_number_info) { delete phone_number_info; }
|
111
|
-
|
112
129
|
extern "C" VALUE rb_phone_number_parse(int argc, VALUE *argv, VALUE self) {
|
113
130
|
return rb_class_new_instance(argc, argv, rb_cPhoneNumber);
|
114
131
|
}
|
115
132
|
|
116
133
|
extern "C" VALUE rb_phone_number_alloc(VALUE self) {
|
117
|
-
|
134
|
+
void *phone_number_data = ALLOC(PhoneNumber);
|
135
|
+
void *data = ALLOC(PhoneNumberInfo);
|
136
|
+
PhoneNumberInfo *phone_number_info = new (data) PhoneNumberInfo();
|
137
|
+
PhoneNumber *phone_number = new (phone_number_data) PhoneNumber();
|
138
|
+
phone_number_info->phone_number = phone_number;
|
118
139
|
|
119
|
-
|
120
|
-
return Data_Wrap_Struct(self, NULL, &rb_phone_number_dealloc, phone_number_info);
|
140
|
+
return TypedData_Wrap_Struct(self, &phone_number_info_type, phone_number_info);
|
121
141
|
}
|
122
142
|
|
123
143
|
static inline VALUE rb_phone_number_nullify_ivars(VALUE self) {
|
@@ -125,6 +145,8 @@ static inline VALUE rb_phone_number_nullify_ivars(VALUE self) {
|
|
125
145
|
rb_iv_set(self, "@raw_national", Qnil);
|
126
146
|
rb_iv_set(self, "@dasherized_national", Qnil);
|
127
147
|
rb_iv_set(self, "@international", Qnil);
|
148
|
+
rb_iv_set(self, "@raw_international", Qnil);
|
149
|
+
rb_iv_set(self, "@dasherized_international", Qnil);
|
128
150
|
rb_iv_set(self, "@e164", Qnil);
|
129
151
|
rb_iv_set(self, "@country_code", Qnil);
|
130
152
|
rb_iv_set(self, "@region_code", Qnil);
|
@@ -158,7 +180,7 @@ extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
|
|
158
180
|
PhoneNumberInfo *phone_number_info;
|
159
181
|
PhoneNumber parsed_number;
|
160
182
|
|
161
|
-
|
183
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
162
184
|
|
163
185
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
164
186
|
|
@@ -170,7 +192,7 @@ extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
|
|
170
192
|
if (result != PhoneNumberUtil::NO_PARSING_ERROR) {
|
171
193
|
rb_phone_number_nullify_ivars(self);
|
172
194
|
} else {
|
173
|
-
phone_number_info->phone_number
|
195
|
+
phone_number_info->phone_number->Swap(&parsed_number);
|
174
196
|
}
|
175
197
|
|
176
198
|
return self;
|
@@ -179,11 +201,11 @@ extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
|
|
179
201
|
static inline VALUE rb_phone_number_format(VALUE self, PhoneNumberUtil::PhoneNumberFormat fmt) {
|
180
202
|
std::string formatted_number;
|
181
203
|
PhoneNumberInfo *phone_number_info;
|
182
|
-
|
204
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
183
205
|
|
184
206
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
185
|
-
PhoneNumber parsed_number = phone_number_info->phone_number;
|
186
|
-
phone_util.Format(parsed_number, fmt, &formatted_number);
|
207
|
+
PhoneNumber *parsed_number = phone_number_info->phone_number;
|
208
|
+
phone_util.Format(*parsed_number, fmt, &formatted_number);
|
187
209
|
|
188
210
|
return rb_str_new(formatted_number.c_str(), formatted_number.size());
|
189
211
|
}
|
@@ -225,9 +247,9 @@ VALUE format_by_pattern_national(VALUE self, RepeatedPtrField<NumberFormat> form
|
|
225
247
|
std::string formatted_number;
|
226
248
|
PhoneNumberInfo *phone_number_info;
|
227
249
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
228
|
-
|
250
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
229
251
|
|
230
|
-
phone_util.FormatByPattern(phone_number_info->phone_number, PhoneNumberUtil::NATIONAL, format, &formatted_number);
|
252
|
+
phone_util.FormatByPattern(*phone_number_info->phone_number, PhoneNumberUtil::NATIONAL, format, &formatted_number);
|
231
253
|
|
232
254
|
return rb_str_new(formatted_number.c_str(), formatted_number.size());
|
233
255
|
}
|
@@ -252,6 +274,47 @@ extern "C" VALUE rb_phone_number_dasherized_national(VALUE self) {
|
|
252
274
|
return rb_iv_set(self, "@dasherized_national", result);
|
253
275
|
}
|
254
276
|
|
277
|
+
extern "C" VALUE rb_phone_number_country_code(VALUE self) {
|
278
|
+
if (rb_ivar_defined(self, rb_intern("@country_code"))) {
|
279
|
+
return rb_iv_get(self, "@country_code");
|
280
|
+
}
|
281
|
+
|
282
|
+
PhoneNumberInfo *phone_number_info;
|
283
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
284
|
+
|
285
|
+
int code = phone_number_info->phone_number->country_code();
|
286
|
+
|
287
|
+
VALUE result = INT2NUM(code);
|
288
|
+
|
289
|
+
return rb_iv_set(self, "@country_code", result);
|
290
|
+
}
|
291
|
+
|
292
|
+
extern "C" VALUE rb_phone_number_dasherized_international(VALUE self) {
|
293
|
+
if (rb_ivar_defined(self, rb_intern("@dasherized_international"))) {
|
294
|
+
return rb_iv_get(self, "@dasherized_international");
|
295
|
+
}
|
296
|
+
|
297
|
+
VALUE national = rb_phone_number_dasherized_national(self);
|
298
|
+
VALUE cc = rb_fix2str(rb_phone_number_country_code(self), 10);
|
299
|
+
VALUE dash = rb_str_new("-", 1);
|
300
|
+
VALUE prefix = rb_str_concat(cc, dash);
|
301
|
+
VALUE result = rb_str_concat(prefix, national);
|
302
|
+
|
303
|
+
return rb_iv_set(self, "@dasherized_international", result);
|
304
|
+
}
|
305
|
+
|
306
|
+
extern "C" VALUE rb_phone_number_raw_international(VALUE self) {
|
307
|
+
if (rb_ivar_defined(self, rb_intern("@raw_international"))) {
|
308
|
+
return rb_iv_get(self, "@raw_international");
|
309
|
+
}
|
310
|
+
|
311
|
+
VALUE national = rb_phone_number_raw_national(self);
|
312
|
+
VALUE cc = rb_fix2str(rb_phone_number_country_code(self), 10);
|
313
|
+
VALUE result = rb_str_concat(cc, national);
|
314
|
+
|
315
|
+
return rb_iv_set(self, "@raw_international", result);
|
316
|
+
}
|
317
|
+
|
255
318
|
extern "C" VALUE rb_phone_number_valid_eh(VALUE self) {
|
256
319
|
if (rb_ivar_defined(self, rb_intern("@valid"))) {
|
257
320
|
return rb_iv_get(self, "@valid");
|
@@ -259,11 +322,11 @@ extern "C" VALUE rb_phone_number_valid_eh(VALUE self) {
|
|
259
322
|
|
260
323
|
std::string formatted_number;
|
261
324
|
PhoneNumberInfo *phone_number_info;
|
262
|
-
|
325
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
263
326
|
|
264
327
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
265
328
|
|
266
|
-
if (phone_util.IsValidNumber(phone_number_info->phone_number)) {
|
329
|
+
if (phone_util.IsValidNumber(*phone_number_info->phone_number)) {
|
267
330
|
return rb_iv_set(self, "@valid", Qtrue);
|
268
331
|
} else {
|
269
332
|
return rb_iv_set(self, "@valid", Qfalse);
|
@@ -281,11 +344,11 @@ extern "C" VALUE rb_phone_number_possible_eh(VALUE self) {
|
|
281
344
|
|
282
345
|
std::string formatted_number;
|
283
346
|
PhoneNumberInfo *phone_number_info;
|
284
|
-
|
347
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
285
348
|
|
286
349
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
287
350
|
|
288
|
-
if (phone_util.IsPossibleNumber(phone_number_info->phone_number)) {
|
351
|
+
if (phone_util.IsPossibleNumber(*phone_number_info->phone_number)) {
|
289
352
|
return rb_iv_set(self, "@possible", Qtrue);
|
290
353
|
} else {
|
291
354
|
return rb_iv_set(self, "@possible", Qfalse);
|
@@ -303,44 +366,38 @@ extern "C" VALUE rb_phone_number_region_code(VALUE self) {
|
|
303
366
|
|
304
367
|
PhoneNumberInfo *phone_number_info;
|
305
368
|
std::string code;
|
306
|
-
|
369
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
307
370
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
308
371
|
|
309
|
-
phone_util.GetRegionCodeForCountryCode(phone_number_info->phone_number
|
372
|
+
phone_util.GetRegionCodeForCountryCode(phone_number_info->phone_number->country_code(), &code);
|
310
373
|
|
311
374
|
VALUE result = rb_str_new(code.c_str(), code.size());
|
312
375
|
|
313
376
|
return rb_iv_set(self, "@region_code", result);
|
314
377
|
}
|
315
378
|
|
316
|
-
extern "C" VALUE
|
317
|
-
if (
|
318
|
-
return
|
379
|
+
extern "C" VALUE rb_phone_number_match_eh(VALUE self, VALUE other) {
|
380
|
+
if (!rb_obj_is_kind_of(other, rb_cPhoneNumber)) {
|
381
|
+
return Qfalse;
|
319
382
|
}
|
320
383
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
int code = phone_number_info->phone_number.country_code();
|
384
|
+
VALUE self_input = rb_iv_get(self, "@input");
|
385
|
+
VALUE other_input = rb_iv_get(other, "@input");
|
325
386
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
extern "C" VALUE rb_phone_number_eql_eh(VALUE self, VALUE other) {
|
332
|
-
if (!rb_obj_is_instance_of(other, rb_cPhoneNumber)) {
|
333
|
-
return Qfalse;
|
387
|
+
// If inputs are the exact same, the result is as well
|
388
|
+
if (rb_eql(self_input, other_input)) {
|
389
|
+
return Qtrue;
|
334
390
|
}
|
335
391
|
|
336
392
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
337
393
|
|
338
|
-
PhoneNumberInfo *
|
339
|
-
|
394
|
+
PhoneNumberInfo *self_info;
|
395
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, self_info);
|
340
396
|
|
341
|
-
PhoneNumberInfo *
|
342
|
-
|
343
|
-
|
397
|
+
PhoneNumberInfo *other_info;
|
398
|
+
TypedData_Get_Struct(other, PhoneNumberInfo, &phone_number_info_type, other_info);
|
399
|
+
|
400
|
+
if (phone_util.IsNumberMatch(*other_info->phone_number, *self_info->phone_number) == PhoneNumberUtil::EXACT_MATCH) {
|
344
401
|
return Qtrue;
|
345
402
|
} else {
|
346
403
|
return Qfalse;
|
@@ -353,14 +410,14 @@ extern "C" VALUE rb_phone_number_type(VALUE self) {
|
|
353
410
|
}
|
354
411
|
|
355
412
|
PhoneNumberInfo *phone_number_info;
|
356
|
-
|
413
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
357
414
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
358
415
|
|
359
416
|
VALUE result;
|
360
417
|
|
361
418
|
// @see
|
362
419
|
// https://github.com/google/libphonenumber/blob/4e9954edea7cf263532c5dd3861a801104c3f012/cpp/src/phonenumbers/phonenumberutil.h#L91
|
363
|
-
switch (phone_util.GetNumberType(phone_number_info->phone_number)) {
|
420
|
+
switch (phone_util.GetNumberType(*phone_number_info->phone_number)) {
|
364
421
|
case PhoneNumberUtil::PREMIUM_RATE:
|
365
422
|
result = rb_intern("premium_rate");
|
366
423
|
break;
|
@@ -409,15 +466,15 @@ extern "C" VALUE rb_phone_number_area_code(VALUE self) {
|
|
409
466
|
|
410
467
|
const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
|
411
468
|
PhoneNumberInfo *phone_number_info;
|
412
|
-
|
469
|
+
TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, phone_number_info);
|
413
470
|
|
414
|
-
PhoneNumber number = phone_number_info->phone_number;
|
471
|
+
PhoneNumber *number = phone_number_info->phone_number;
|
415
472
|
string national_significant_number;
|
416
|
-
phone_util.GetNationalSignificantNumber(number, &national_significant_number);
|
473
|
+
phone_util.GetNationalSignificantNumber(*number, &national_significant_number);
|
417
474
|
string area_code;
|
418
475
|
string subscriber_number;
|
419
476
|
|
420
|
-
int area_code_length = phone_util.GetLengthOfGeographicalAreaCode(number);
|
477
|
+
int area_code_length = phone_util.GetLengthOfGeographicalAreaCode(*number);
|
421
478
|
if (area_code_length > 0) {
|
422
479
|
area_code = national_significant_number.substr(0, area_code_length);
|
423
480
|
subscriber_number = national_significant_number.substr(area_code_length, string::npos);
|
@@ -431,6 +488,8 @@ extern "C" VALUE rb_phone_number_area_code(VALUE self) {
|
|
431
488
|
return rb_iv_set(self, "@area_code", result);
|
432
489
|
}
|
433
490
|
|
491
|
+
extern "C" VALUE rb_phone_number_to_s(VALUE self) { return rb_iv_get(self, "@input"); }
|
492
|
+
|
434
493
|
static inline void setup_formats() {
|
435
494
|
// Raw
|
436
495
|
NumberFormat *raw_fmt = raw_national_format.Add();
|
@@ -481,6 +540,10 @@ extern "C" void Init_mini_phone(void) {
|
|
481
540
|
rb_define_method(rb_cPhoneNumber, "national", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_national), 0);
|
482
541
|
|
483
542
|
rb_define_method(rb_cPhoneNumber, "raw_national", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_raw_national), 0);
|
543
|
+
rb_define_method(rb_cPhoneNumber, "raw_international",
|
544
|
+
reinterpret_cast<VALUE (*)(...)>(rb_phone_number_raw_international), 0);
|
545
|
+
rb_define_method(rb_cPhoneNumber, "dasherized_international",
|
546
|
+
reinterpret_cast<VALUE (*)(...)>(rb_phone_number_dasherized_international), 0);
|
484
547
|
rb_define_method(rb_cPhoneNumber, "dasherized_national",
|
485
548
|
reinterpret_cast<VALUE (*)(...)>(rb_phone_number_dasherized_national), 0);
|
486
549
|
rb_define_method(rb_cPhoneNumber, "international", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_international),
|
@@ -491,5 +554,6 @@ extern "C" void Init_mini_phone(void) {
|
|
491
554
|
rb_define_method(rb_cPhoneNumber, "country_code", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_country_code), 0);
|
492
555
|
rb_define_method(rb_cPhoneNumber, "type", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_type), 0);
|
493
556
|
rb_define_method(rb_cPhoneNumber, "area_code", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_area_code), 0);
|
494
|
-
rb_define_method(rb_cPhoneNumber, "
|
557
|
+
rb_define_method(rb_cPhoneNumber, "to_s", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_to_s), 0);
|
558
|
+
rb_define_method(rb_cPhoneNumber, "==", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_match_eh), 1);
|
495
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.
|
4
|
+
version: 1.1.3
|
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-26 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
|