mini_phone 0.1.7 → 1.0.0.beta.0
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/.github/workflows/ci.yml +1 -1
- data/ext/mini_phone/mini_phone.cc +10 -10
- data/lib/mini_phone/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98edc8a1bf120a002c013d80d48ea0bd55c2f1d2bcb2912c02721ee58140a8f7
|
4
|
+
data.tar.gz: 52849767577cb45129bae6fb875f343316291da9600de16dbe406cc8c7705242
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6ee4d57ff10389a45d0072b464098cee65fde3d7792127002e9a82879bd08077dec3182dcc243213510f4dd303c643202135f586c528463516f042dfae7c6cf
|
7
|
+
data.tar.gz: 564fb760f1a5cdcb9b81835511dc3a382632fa93b8235abb6384a3aa85ce727eaaa9cff031bf377669a102208776179e1b08000dc72a6cfe7d83caa75bde96a7
|
data/.github/workflows/ci.yml
CHANGED
@@ -30,7 +30,7 @@ static inline VALUE is_phone_number_valid(VALUE self, VALUE str, VALUE cc) {
|
|
30
30
|
}
|
31
31
|
|
32
32
|
extern "C" VALUE rb_is_phone_number_valid(VALUE self, VALUE str) {
|
33
|
-
VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@
|
33
|
+
VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
|
34
34
|
|
35
35
|
return is_phone_number_valid(self, str, def_cc);
|
36
36
|
}
|
@@ -51,7 +51,7 @@ extern "C" VALUE rb_is_phone_number_possible(VALUE self, VALUE str) {
|
|
51
51
|
PhoneNumber parsed_number;
|
52
52
|
PhoneNumberUtil *phone_util = PhoneNumberUtil::GetInstance();
|
53
53
|
|
54
|
-
VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@
|
54
|
+
VALUE def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
|
55
55
|
std::string phone_number(RSTRING_PTR(str), RSTRING_LEN(str));
|
56
56
|
std::string country_code(RSTRING_PTR(def_cc), RSTRING_LEN(def_cc));
|
57
57
|
|
@@ -68,11 +68,11 @@ extern "C" VALUE rb_is_phone_number_impossible(VALUE self, VALUE str) {
|
|
68
68
|
return rb_is_phone_number_possible(self, str) == Qtrue ? Qfalse : Qtrue;
|
69
69
|
}
|
70
70
|
|
71
|
-
extern "C" VALUE
|
72
|
-
return rb_iv_set(self, "@
|
71
|
+
extern "C" VALUE rb_set_default_country(VALUE self, VALUE str_code) {
|
72
|
+
return rb_iv_set(self, "@default_country", str_code);
|
73
73
|
}
|
74
74
|
|
75
|
-
extern "C" VALUE
|
75
|
+
extern "C" VALUE rb_get_default_country(VALUE self) { return rb_iv_get(self, "@default_country"); }
|
76
76
|
|
77
77
|
extern "C" void rb_phone_number_dealloc(PhoneNumberInfo *phone_number_info) { delete phone_number_info; }
|
78
78
|
|
@@ -108,7 +108,7 @@ extern "C" VALUE rb_phone_number_initialize(int argc, VALUE *argv, VALUE self) {
|
|
108
108
|
rb_scan_args(argc, argv, "11", &str, &def_cc);
|
109
109
|
|
110
110
|
if (NIL_P(def_cc)) {
|
111
|
-
def_cc = rb_iv_get(rb_mMiniPhone, "@
|
111
|
+
def_cc = rb_iv_get(rb_mMiniPhone, "@default_country");
|
112
112
|
}
|
113
113
|
|
114
114
|
rb_iv_set(self, "@input", str);
|
@@ -339,7 +339,7 @@ extern "C" void Init_mini_phone(void) {
|
|
339
339
|
rb_mMiniPhone = rb_define_module("MiniPhone");
|
340
340
|
|
341
341
|
// Unknown
|
342
|
-
rb_iv_set(rb_mMiniPhone, "@
|
342
|
+
rb_iv_set(rb_mMiniPhone, "@default_country", rb_str_new("ZZ", 2));
|
343
343
|
|
344
344
|
rb_define_module_function(rb_mMiniPhone, "valid?", reinterpret_cast<VALUE (*)(...)>(rb_is_phone_number_valid), 1);
|
345
345
|
rb_define_module_function(rb_mMiniPhone, "valid_for_country?",
|
@@ -351,9 +351,9 @@ extern "C" void Init_mini_phone(void) {
|
|
351
351
|
rb_define_module_function(rb_mMiniPhone, "impossible?", reinterpret_cast<VALUE (*)(...)>(rb_is_phone_number_invalid),
|
352
352
|
1);
|
353
353
|
rb_define_module_function(rb_mMiniPhone,
|
354
|
-
"
|
355
|
-
rb_define_module_function(rb_mMiniPhone, "
|
356
|
-
reinterpret_cast<VALUE (*)(...)>(
|
354
|
+
"default_country=", reinterpret_cast<VALUE (*)(...)>(rb_set_default_country), 1);
|
355
|
+
rb_define_module_function(rb_mMiniPhone, "default_country",
|
356
|
+
reinterpret_cast<VALUE (*)(...)>(rb_get_default_country), 0);
|
357
357
|
rb_define_module_function(rb_mMiniPhone, "parse", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_parse), -1);
|
358
358
|
|
359
359
|
rb_cPhoneNumber = rb_define_class_under(rb_mMiniPhone, "PhoneNumber", rb_cObject);
|
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: 0.
|
4
|
+
version: 1.0.0.beta.0
|
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-07 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.
|
@@ -58,9 +58,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
58
|
version: 2.5.0
|
59
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - ">"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: 1.3.1
|
64
64
|
requirements: []
|
65
65
|
rubygems_version: 3.1.4
|
66
66
|
signing_key:
|