Module: OldKana
- Included in:
- String
- Defined in:
- lib/old_kana.rb,
lib/old_kana/version.rb
Constant Summary collapse
- OLD_KANA_TO_GENDAI_KANA =
{ "は" => "わ", "ひ" => "い", "ふ" => "う", "へ" => "え", "ほ" => "お", "ゐ" => "い", "ゑ" => "え", "ぢ" => "じ", "づ" => "ず" }
- VERSION =
"0.1.0"
Instance Method Summary collapse
Instance Method Details
#to_gendaikana ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/old_kana.rb', line 11 def to_gendaikana replaced = gsub(/(?<!^)[はひふへほ]/) { |old_kana| OLD_KANA_TO_GENDAI_KANA[old_kana] } .gsub(/[ゐゑぢづ]/) { |old_kana| OLD_KANA_TO_GENDAI_KANA[old_kana] } .gsub(/\bを\b/, "お") .gsub(/くわ/, "か") .gsub(/ぐわ/, "が") .gsub(/(?<!^)む/, "ん") replaced.to_roman .gsub(/shi/, "si") .gsub(/au/, "ou") .gsub(/iu/, "yuu") .gsub(/eu|ehu/, "you") .roman_to_hiragana .tr("n", "ん") end |