class Ting::Conversion
Base class for conversions like Hanyu pinyin, Wade-Giles, etc.
Attributes
name[R]
preprocessor[R]
An optional lambda that preprocesses input
syllable_separator[R]
Separator between syllables in the same word For Wade-Giles this is a dash, Hanyu pinyin uses a single quote in certain situations
tones[R]
The tone handling object
Public Class Methods
new(tone = :numbers, options = {})
click to toggle source
# File lib/ting/conversion.rb, line 29 def initialize(tone = :numbers, options = {}) @preprocessor = options[:preprocessor] || lambda {|s| s} if Tone === tone @tone = tone else @tone = Ting::Tones.const_get(Ting.camelize(tone.to_s)) end @name = self.class.name.underscore end
Public Instance Methods
parse(string)
click to toggle source
Converts a string into an array of strings and syllable objects.
# File lib/ting/conversion.rb, line 43 def parse(string) end
unparse(array)
click to toggle source
Converts an array of strings and syllable objects into a string
# File lib/ting/conversion.rb, line 48 def unparse(array) end