Class: Pinyin::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/pinyin.rb

Instance Method Summary collapse

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