Class: Pinyin::Converter
- Inherits:
-
Object
- Object
- Pinyin::Converter
- Defined in:
- lib/pinyin.rb
Instance Method Summary collapse
- #convert(str) ⇒ Object (also: #<<)
-
#initialize(from, from_tone, to, to_tone) ⇒ Converter
constructor
A new instance of Converter.
Constructor Details
#initialize(from, from_tone, to, to_tone) ⇒ Converter
Returns a new instance of Converter.
65 66 67 68 |
# File 'lib/pinyin.rb', line 65 def initialize(from, from_tone, to, to_tone) @reader = Reader.new(from, from_tone) @writer = Writer.new(to, to_tone) end |
Instance Method Details
#convert(str) ⇒ Object Also known as: <<
70 71 72 |
# File 'lib/pinyin.rb', line 70 def convert(str) @writer.unparse @reader.parse(str) end |