lib/itaiji/converter.rb in itaiji-0.1.6 vs lib/itaiji/converter.rb in itaiji-0.2.0

- old
+ new

@@ -1,23 +1,35 @@ module Itaiji class Converter - def convert_seijitai(string) + def seijitai(string) itaiji_list.inject(string) do |string, itaiji_set| seijitai = itaiji_set.keys.first itaijis = itaiji_set.values.first string.gsub(/#{itaijis.join('|')}/, seijitai) end end - def convert_itaiji(string) + def convert_seijitai(string) + seijitai(string) + end + + def itaiji(string) itaiji_list.inject(string) do |string, itaiji_set| seijitai = itaiji_set.keys.first itaiji = itaiji_set.values.flatten.first string.gsub(/#{seijitai}/, itaiji) end 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 itaiji_list [