Sha256: 7c43276c5421494e65bd8dc8288e2773dd11a18cb9b1457f67c0f4177fe4949a

Contents?: true

Size: 338 Bytes

Versions: 12

Compression:

Stored size: 338 Bytes

Contents

# frozen_string_literal: true

module Dpl
  module Transliterate
    APPROXIMATIONS = YAML.load(File.read(File.expand_path('../../../config/transliterate.yml', __dir__)))

    def transliterate(string, replacement = '.')
      string.gsub(/[^\x00-\x7f]/u) do |char|
        APPROXIMATIONS[char] || replacement
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
dpl-2.0.5.3 lib/dpl/helper/transliterate.rb
dpl-2.0.5.3.beta.1 lib/dpl/helper/transliterate.rb
dpl-2.0.5.2 lib/dpl/helper/transliterate.rb
dpl-2.0.5.2.beta.1 lib/dpl/helper/transliterate.rb
dpl-2.0.5.1 lib/dpl/helper/transliterate.rb
dpl-2.0.5.beta.2.1 lib/dpl/helper/transliterate.rb
dpl-2.0.5.beta.2 lib/dpl/helper/transliterate.rb
dpl-2.0.5 lib/dpl/helper/transliterate.rb
dpl-2.0.5.beta.1 lib/dpl/helper/transliterate.rb
dpl-2.0.5.beta lib/dpl/helper/transliterate.rb
travis_dpl_test-2.0.3.beta.4.ror.1 lib/dpl/helper/transliterate.rb
travis_dpl_test-2.0.3.beta.4.ror lib/dpl/helper/transliterate.rb