Class: Sawarineko::Converter
- Inherits:
-
Object
- Object
- Sawarineko::Converter
- Defined in:
- lib/sawarineko/converter.rb
Overview
Convert plain text to Sawarineko text.
Instance Method Summary collapse
-
#convert(source) ⇒ Object
Convert the source.
Instance Method Details
#convert(source) ⇒ Object
Convert the source.
source - The String source to convert.
Returns the String converted to Sawarineko.
11 12 13 14 15 16 |
# File 'lib/sawarineko/converter.rb', line 11 def convert(source) source .gsub(/な/, 'にゃ') .gsub(/ナ/, 'ニャ') .gsub(/[나-낳]/) { |ch| (ch.ord + 56).chr(Encoding::UTF_8) } end |