lib/ting/conversion.rb in ting-0.3.0 vs lib/ting/conversion.rb in ting-0.9.0
- old
+ new
@@ -1,18 +1,20 @@
+# coding: utf-8
+
module Ting
-
+
#
- # Base class for conversions like Hanyu pinyin,
+ # Base class for conversions like Hanyu pinyin,
# Wade-Giles, etc.
#
class Conversion
# Separator between syllables in the same word
# For Wade-Giles this is a dash, Hanyu pinyin
# uses a single quote in certain situations
attr_reader :syllable_separator
-
+
# The tone handling object
attr_reader :tones
# An optional lambda that preprocesses input
attr_reader :preprocessor
@@ -28,11 +30,11 @@
@preprocessor = options[:preprocessor] || lambda {|s| s}
if Tone === tone
@tone = tone
else
- @tone = Ting::Tones.const_get(tone.to_s.camelcase)
+ @tone = Ting::Tones.const_get(Ting.camelize(tone.to_s))
end
@name = self.class.name.underscore
end
@@ -46,6 +48,5 @@
def unparse(array)
end
end
end
-