1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
Description: Switch unaccent implementation
This reverts the PR mentioned below, as unaccent is not available.
Author: Simon Quigley <tsimonq2@debian.org>
Origin: https://github.com/countries/countries/pull/767
Last-Update: 2026-02-12
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/countries.gemspec
+++ b/countries.gemspec
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
gem.required_ruby_version = '>= 3.2'
- gem.add_dependency('unaccent', '~> 0.3')
+ gem.add_dependency('sixarm_ruby_unaccent')
gem.add_development_dependency('activesupport', '>= 3', '< 8')
gem.add_development_dependency('nokogiri', '>= 1.8')
gem.add_development_dependency('rspec', '>= 3')
--- a/lib/countries/country/class_methods.rb
+++ b/lib/countries/country/class_methods.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'unaccent'
+require 'sixarm_ruby_unaccent'
module ISO3166
UNSEARCHABLE_METHODS = [:translations].freeze
@@ -93,9 +93,9 @@ module ISO3166
# :reek:UtilityFunction
def strip_accents(string)
if string.is_a?(Regexp)
- Regexp.new(Unaccent.unaccent(string.source), 'i')
+ Regexp.new(string.source.unaccent, 'i')
else
- Unaccent.unaccent(string.to_s).downcase
+ string.to_s.unaccent.downcase
end
end
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -2,7 +2,6 @@ PATH
remote: .
specs:
countries (8.1.0)
- unaccent (~> 0.3)
GEM
remote: https://rubygems.org/
@@ -105,7 +104,6 @@ GEM
tsort (0.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
- unaccent (0.4.0)
yaml (0.4.0)
PLATFORMS
|