Sha256: d19658784c437951fa79e5250608d11ba9c0977c1facbea51b8c20f789b2e838
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
module Itaiji class Converter def seijitai(string) string.gsub(/#{seijitai_pairs.keys.join("|")}/, seijitai_pairs) end def convert_seijitai(string) seijitai(string) end def itaiji(string) string.gsub(/#{itaiji_pairs.keys.join("|")}/, itaiji_pairs) end def convert_itaiji(string) itaiji(string) end extend Gem::Deprecate deprecate :convert_seijitai, :seijitai, 2018, 1 deprecate :convert_itaiji, :itaiji, 2018, 1 private def seijitai_pairs @seijitai_pairs ||= itaiji_list.inject({}) do |pairs, (seijitai, itaijis)| itaijis.each do |itaiji| pairs[itaiji] = seijitai end pairs end end def itaiji_pairs @itaiji_pairs ||= itaiji_list.inject({}) do |pairs, (seijitai, itaijis)| pairs[seijitai] = itaijis.first pairs end end def itaiji_list @itaiji_list ||= begin itaiji_file_path = File.expand_path('../../../source/itaji_list.yml', __FILE__) YAML.load_file(itaiji_file_path) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
itaiji-0.3.1 | lib/itaiji/converter.rb |
itaiji-0.3.0 | lib/itaiji/converter.rb |