require "active_support" module Amakanize class AuthorName ENCLOSED_ALPHANUMERICS = %w( ⓿ ⓪ ➀ ➊ ➀ ❶ ① ⓵ ⓾ ➉ ❿ ➉ ➓ ⑩ ⓫ ⑪ ⓬ ⑫ ⑬ ⓭ ⑭ ⓮ ⑮ ⓯ ⑯ ⓰ ⓱ ⑰ ⓲ ⑱ ⑲ ⓳ ❷ ⓶ ② ➁ ➋ ➁ ⓴ ⑳ ㉑ ㉒ ㉓ ㉔ ㉕ ㉖ ㉗ ㉘ ㉙ ➌ ➂ ⓷ ❸ ③ ➂ ㉚ ㉛ ㉜ ㉝ ㉞ ㉟ ㊱ ㊲ ㊳ ㊴ ➃ ➍ ⓸ ④ ❹ ➃ ㊵ ㊶ ㊷ ㊸ ㊹ ㊺ ㊻ ㊼ ㊽ ㊾ ⑤ ⓹ ➄ ➄ ❺ ➎ ㊿ ⑥ ➅ ❻ ➏ ⓺ ➅ ➆ ⑦ ➐ ⓻ ➆ ❼ ⑧ ➇ ➇ ❽ ⓼ ➑ ❾ ⑨ ➈ ⓽ ➒ ➈ ⓐ Ⓐ ⓑ Ⓑ ⓒ Ⓒ ⓓ Ⓓ ⓔ Ⓔ ⓕ Ⓕ ⓖ Ⓖ ⓗ Ⓗ ⓘ Ⓘ ⓙ Ⓙ ⓚ Ⓚ ⓛ Ⓛ ⓜ Ⓜ ⓝ Ⓝ ⓞ Ⓞ ⓟ Ⓟ ⓠ Ⓠ ⓡ Ⓡ ⓢ Ⓢ ⓣ Ⓣ ⓤ Ⓤ ⓥ Ⓥ ⓦ Ⓦ ⓧ Ⓧ ⓨ Ⓨ ⓩ Ⓩ ) # @param raw [String] def initialize(raw) @raw = raw end # @note Override def to_s ENCLOSED_ALPHANUMERICS.inject(@raw) do |result, enclosed_alphanumerics| result.gsub(enclosed_alphanumerics) do |matched_string| half_size_alphanumerics = ::ActiveSupport::Multibyte::Unicode.normalize(matched_string) "(#{half_size_alphanumerics})" end end end end end