Sha256: 6704269e9d29a884617727c3fd2c5e2a8e41d7f8847b9dee2b2394cd599a007b
Contents?: true
Size: 531 Bytes
Versions: 4
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.chars.last) 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ting-0.12.0 | lib/ting/tones/supernum.rb |
ting-0.11.0 | lib/ting/tones/supernum.rb |
ting-0.10.0 | lib/ting/tones/supernum.rb |
ting-0.9.0 | lib/ting/tones/supernum.rb |