From 2a1c9a871a333d6902e3e868b3eea323cb3f34fb Mon Sep 17 00:00:00 2001 From: Daniel Pepper Date: Sat, 3 Oct 2026 22:04:29 -0700 Subject: [PATCH] Remove unused private helpers - Faker::Company#calculate_gst_checksum: never called; indian_gst_number computes its checksum inline (both added in 205bc521). - Faker::Types#titleize: only called by its own test through `send` since it was added (28eaeb6d); the test goes with it. - TestFakerTypes::TestModule: empty and unreferenced since 28eaeb6d. Co-Authored-By: Claude Opus 5.5 --- lib/faker/default/company.rb | 13 ------------- lib/faker/default/types.rb | 6 ------ test/faker/default/test_faker_types.rb | 10 ---------- 3 files changed, 29 deletions(-) diff --git a/lib/faker/default/company.rb b/lib/faker/default/company.rb index e694f9802f..0f341fe32d 100644 --- a/lib/faker/default/company.rb +++ b/lib/faker/default/company.rb @@ -660,19 +660,6 @@ def spanish_b_algorithm(value) result.to_s[0].to_i + result.to_s[1].to_i end - - def calculate_gst_checksum(state_code, taxpayer_number, registration_number) - gst_base = "#{state_code}#{taxpayer_number}#{registration_number}" - chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'.chars - values = gst_base.upcase.chars - sum = values.map.with_index do |char, index| - product = chars.index(char) * (index.odd? ? 2 : 1) - (product / chars.length).floor + (product % chars.length) - end.reduce(:+) - - checksum = (chars.length - (sum % chars.length)) % chars.length - chars[checksum] - end end end end diff --git a/lib/faker/default/types.rb b/lib/faker/default/types.rb index 2c7a3634e1..1e793a3342 100644 --- a/lib/faker/default/types.rb +++ b/lib/faker/default/types.rb @@ -148,12 +148,6 @@ def random_complex_type rb_array end end - - private - - def titleize(word) - word.split(/(\W)/).map(&:capitalize).join - end end end end diff --git a/test/faker/default/test_faker_types.rb b/test/faker/default/test_faker_types.rb index 29e2d58d4c..079a11a2d2 100644 --- a/test/faker/default/test_faker_types.rb +++ b/test/faker/default/test_faker_types.rb @@ -3,9 +3,6 @@ require_relative '../../test_helper' class TestFakerTypes < Test::Unit::TestCase - module TestModule - end - def setup @tester = Faker::Types end @@ -74,13 +71,6 @@ def test_array_has_the_right_array assert_equal(1, @tester.rb_array.length) end - def test_titleize - val = 'foobar' - expected = 'Foobar' - - assert_equal @tester.send(:titleize, val), expected - end - def test_resolve array = [1, 2, 3] range = 1..10