Sha256: fd22216f9fa040a3a878fc42499e4ac9e79b917af995a681ccea6ebb5c1f110b

Contents?: true

Size: 501 Bytes

Versions: 1

Compression:

Stored size: 501 Bytes

Contents

# encoding: utf-8
require File.dirname(__FILE__) + '/constant'

module Spinying
  module CoreExt
      def self.get_pinying(word)
        pingying = ""
        word.each_codepoint do |codepoint|
          pingying << (hanzi?(codepoint) ? ZHUNICODETABLE[codepoint-ZHUNICODESTART] : codepoint)
        end
        return pingying.downcase
      end
      
      private
      
      def self.hanzi?(hanzi_code_point)  
          (ZHUNICODESTART..ZHUNICODEEND) === hanzi_code_point;  
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spinying-0.9 lib/spinying/core_ext.rb