Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/pinyin/string.rb,
lib/pinyin/support.rb
Instance Method Summary collapse
Instance Method Details
#bpmf ⇒ Object
8 9 10 11 12 13 |
# File 'lib/pinyin/string.rb', line 8 def bpmf self.gsub('u:','ü').scan(/[A-Za-züÜ]{1,5}\d/).map do |m| .(:marks) << (.HanyuReader(:numbers) << m.downcase) end.join(' ') end |
#chars ⇒ Object
2 3 4 |
# File 'lib/pinyin/support.rb', line 2 def chars self.unpack('U*').map{|c| [c].pack('U')} end |
#pretty_tones ⇒ Object
2 3 4 5 6 |
# File 'lib/pinyin/string.rb', line 2 def pretty_tones self.gsub('u:','ü').gsub(/[A-Za-züÜ]{1,5}\d/) do |m| .HanyuWriter(:accents) << .HanyuReader(:numbers).parse(m.downcase) end end |