mini_phone 1.1.1 → 1.1.2

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: 9fb40430cfcb4a6d8cc44557e7fb84622fe20cf14819c14f10a919dc5b9880e7
4
- data.tar.gz: 5ad868da4e69d3b0ef3b91687863547ea876ec01e0bd2d7ae2e9bea1c8e16668
3
+ metadata.gz: 45a73dd6dde16c5baff08c0d9cf225e4bb53ae15b8b040559e4555180070e8d1
4
+ data.tar.gz: cbb196644cb95f7cf3a46648c176e22845708f5e3bab14256a8d80832e187175
5
5
  SHA512:
6
- metadata.gz: df02fd332486b4b1c2775420377d2b478324b1b25de950268279ce6dd1875373dd4c7bc798300b0446cee72d7581d7338f4a0725d811a0ff317b7209bdebb4a7
7
- data.tar.gz: a4130f908c91d8369665ec31174857ab6a2e7dc07b85f97008560a3d057db23a49dc39b85e53d0f61a290e0f89c8b320b2f5023041b0b19704bf66f9363ed672
6
+ metadata.gz: b95b0e2e18d15b7cf7c17e901a85d0b42f2e5fd6d9947f6d0e63a97197c86b39ce8f6341669e67ab69a07a6356b336f3cf4659a328a9c603a6d03856ac7c325b
7
+ data.tar.gz: 5db0ebb434cd3d427ae511e2a3e8bad13bcc7520c1147e1d7a8fafbf06c3213ae8521b30234b7691d0f06f634e0a503912bf638820f7dd37750ea12838944cf3
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ gemspec
8
8
  gem 'rake', require: false
9
9
  # https://github.com/rake-compiler/rake-compiler/pull/166
10
10
  gem 'get_process_mem', require: false
11
+ gem 'pry', require: false
11
12
  gem 'rake-compiler', github: 'larskanis/rake-compiler', branch: 'fix-native-version'
12
13
  gem 'rspec', '~> 3.0', require: false
13
14
  gem 'rspec-github', require: false
@@ -376,20 +376,28 @@ extern "C" VALUE rb_phone_number_region_code(VALUE self) {
376
376
  return rb_iv_set(self, "@region_code", result);
377
377
  }
378
378
 
379
- extern "C" VALUE rb_phone_number_eql_eh(VALUE self, VALUE other) {
380
- if (!rb_obj_is_instance_of(other, rb_cPhoneNumber)) {
379
+ extern "C" VALUE rb_phone_number_match_eh(VALUE self, VALUE other) {
380
+ if (!rb_obj_is_kind_of(other, rb_cPhoneNumber)) {
381
381
  return Qfalse;
382
382
  }
383
383
 
384
+ VALUE self_input = rb_iv_get(self, "@input");
385
+ VALUE other_input = rb_iv_get(other, "@input");
386
+
387
+ // If inputs are the exact same, the result is as well
388
+ if (rb_eql(self_input, other_input)) {
389
+ return Qtrue;
390
+ }
391
+
384
392
  const PhoneNumberUtil &phone_util(*PhoneNumberUtil::GetInstance());
385
393
 
386
- PhoneNumberInfo *self_phone_number_info;
387
- TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, self_phone_number_info);
394
+ PhoneNumberInfo *self_info;
395
+ TypedData_Get_Struct(self, PhoneNumberInfo, &phone_number_info_type, self_info);
388
396
 
389
- PhoneNumberInfo *other_phone_number_info;
390
- TypedData_Get_Struct(other, PhoneNumberInfo, &phone_number_info_type, other_phone_number_info);
397
+ PhoneNumberInfo *other_info;
398
+ TypedData_Get_Struct(other, PhoneNumberInfo, &phone_number_info_type, other_info);
391
399
 
392
- if (phone_util.IsNumberMatch(*other_phone_number_info->phone_number, *self_phone_number_info->phone_number)) {
400
+ if (phone_util.IsNumberMatch(*other_info->phone_number, *self_info->phone_number) == PhoneNumberUtil::EXACT_MATCH) {
393
401
  return Qtrue;
394
402
  } else {
395
403
  return Qfalse;
@@ -547,5 +555,5 @@ extern "C" void Init_mini_phone(void) {
547
555
  rb_define_method(rb_cPhoneNumber, "type", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_type), 0);
548
556
  rb_define_method(rb_cPhoneNumber, "area_code", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_area_code), 0);
549
557
  rb_define_method(rb_cPhoneNumber, "to_s", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_to_s), 0);
550
- rb_define_method(rb_cPhoneNumber, "eql?", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_eql_eh), 1);
558
+ rb_define_method(rb_cPhoneNumber, "==", reinterpret_cast<VALUE (*)(...)>(rb_phone_number_match_eh), 1);
551
559
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MiniPhone
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
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.1
4
+ version: 1.1.2
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-19 00:00:00.000000000 Z
11
+ date: 2021-01-22 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.