Sha256: d6e0e37a06e52d2078d1510036358c76bb2f99f6cfeb35d94e21c79752758d42
Contents?: true
Size: 844 Bytes
Versions: 1
Compression:
Stored size: 844 Bytes
Contents
module Itaiji class Converter def seijitai(string) string.gsub(/#{seijitai_pairs.keys.join("|")}/, seijitai_pairs) end def itaiji(string) string.gsub(/#{itaiji_pairs.keys.join("|")}/, itaiji_pairs) end 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/itaiji_list.yml', __FILE__) YAML.load_file(itaiji_file_path) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
itaiji-1.0.0 | lib/itaiji/converter.rb |