Sha256: 0efbf5a80ab5a50421ebfe13180dea29586c8cbee9c35db1f02242f2915b8e3b
Contents?: true
Size: 545 Bytes
Versions: 2
Compression:
Stored size: 545 Bytes
Contents
module Ting module Tones class Marks < Tone class <<self GLYPHS=['˙', '', 'ˊ', 'ˇ', 'ˋ'] def add_tone(syll,tone) syll + GLYPHS[normalize(tone) % 5] end def peek_tone(syll) case syll when /ˊ/ : 2 when /ˇ/ : 3 when /ˋ/ : 4 when /˙/ : NEUTRAL_TONE else 1 end end def pop_tone(syll) [ peek_tone(syll), syll[/\A[^#{GLYPHS.join}]+/] ] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ting-0.2.1 | lib/ting/tones/marks.rb |
ting-0.2.0 | lib/ting/tones/marks.rb |