Sha256: e5f55b66db3c218dc05f018ee4e43a6ad6831894b8d2a30f2267de753a64e650
Contents?: true
Size: 531 Bytes
Versions: 1
Compression:
Stored size: 531 Bytes
Contents
# coding: utf-8 module Ting module Tones class Supernum < Tone class <<self GLYPHS=['', '¹', '²', '³', '⁴',] #⁰ for neutral tone? def add_tone(syll,tone) syll + GLYPHS[normalize(tone) % 5] end def peek_tone(syll) if t = GLYPHS.index(syll.uchars[-1]) return t end return NEUTRAL_TONE end def pop_tone(syll) [ peek_tone(syll), syll[/\A[^#{GLYPHS.join}]+/] ] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ting-0.3.0 | lib/ting/tones/supernum.rb |