# frozen_string_literal: truerequire"singleton"moduleBabosamoduleTransliteratordefself.get(symbol)class_name=symbol.to_s.split("_").map{|a|a.gsub(/\b('?[a-z])/){Regexp.last_match(1).upcase}}.joinconst_get(class_name)endclassBaseincludeSingletonAPPROXIMATIONS={"×"=>"x","÷"=>"/","‐"=>"-","‑"=>"-","‒"=>"-","–"=>"-","—"=>"-","―"=>"-","‘"=>"'","‛"=>"'","“"=>'"',"”"=>'"',"„"=>'"',"‟"=>'"',"’"=>"'",","=>",","。"=>".","!"=>"!","?"=>"?","、"=>",","("=>"(",")"=>")","【"=>"[","】"=>"]",";"=>";",":"=>":","《"=>"<","》"=>">",# various kinds of space characters"\xc2\xa0"=>" ","\xe2\x80\x80"=>" ","\xe2\x80\x81"=>" ","\xe2\x80\x82"=>" ","\xe2\x80\x83"=>" ","\xe2\x80\x84"=>" ","\xe2\x80\x85"=>" ","\xe2\x80\x86"=>" ","\xe2\x80\x87"=>" ","\xe2\x80\x88"=>" ","\xe2\x80\x89"=>" ","\xe2\x80\x8a"=>" ","\xe2\x81\x9f"=>" ","\xe3\x80\x80"=>" "}.freezeattr_reader:approximationsdefinitialize@approximations=ifself.class<Baseself.class.superclass.instance.approximations.dupelse{}endself.class.const_get(:APPROXIMATIONS).each_with_object(@approximations)do|object,memo|index=object[0].codepoints.shiftvalue=object[1].codepointsmemo[index]=value.length==1?value[0]:valueend@approximations.freezeend# Accepts a single UTF-8 codepoint and returns the ASCII character code# used as the transliteration value.def[](codepoint)@approximations[codepoint]end# Transliterates a string.deftransliterate(string)string.codepoints.map{|char|self[char]||char}.flatten.pack("U*")endendendendDir[File.expand_path("*.rb",__dir__)].reject{|f|f.end_with?("base.rb")}.sort.each(&method(:require))