Sha256: bbc9d2a0402d9ce5ebde3b97d306615444bd16c61b824214f9932eacabc6ea1c
Contents?: true
Size: 487 Bytes
Versions: 2
Compression:
Stored size: 487 Bytes
Contents
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) return t if t = GLYPHS.index(syll.chars[-1]) return NEUTRAL_TONE 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/supernum.rb |
ting-0.2.0 | lib/ting/tones/supernum.rb |