From 7a53db301a39821efb03b3a4dd9bca1892473a09 Mon Sep 17 00:00:00 2001 From: Laurent Stacul Date: Mon, 19 Jan 2026 11:00:04 +0100 Subject: [PATCH] Linting in spec/phonelib_spec.rb Problem: I spot two enumerator usage that can be improved. Solution: - `each_with_index` can be replaced with `each` if the index is not used. - `Hash#each` can be replaced by `each_value` if the key is not used. --- spec/phonelib_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/phonelib_spec.rb b/spec/phonelib_spec.rb index 1b63656..3d8ebd7 100644 --- a/spec/phonelib_spec.rb +++ b/spec/phonelib_spec.rb @@ -481,7 +481,7 @@ ['01114552586', 'US'], ['01148209679', 'CA'], ['000000000000000', 'CN'], ['0050016323', 'KR'] ] - test_cases.each_with_index do |test_case, i| + test_cases.each do |test_case| number, country = test_case phone = Phonelib.parse number, country expect(phone.valid_for_country?(country)).to be false @@ -1478,7 +1478,7 @@ it 'are valid' do data_file = File.dirname(__FILE__) + '/../data/phone_data.dat' phone_data = Marshal.load(File.binread(data_file)) - phone_data.each do |key, data| + phone_data.each_value do |data| country = data[:id] next unless country =~ /[A-Z]{2}/ data[:types].each do |type, type_data|