Sha256: 862528040bebb06649ea9462ffd56bb8937fa72f9c57a7b800e2f5857ddefffd
Contents?: true
Size: 818 Bytes
Versions: 4
Compression:
Stored size: 818 Bytes
Contents
$KCODE = 'U' module Gimchi class Korean # Checks if the given character is a korean character. # @param [String] ch A string of size 1 def korean_char? ch raise ArgumentError.new('Lengthy input') if str_length(ch) > 1 complete_korean_char?(ch) || (chosungs + jungsungs + jongsungs).include?(ch) end # Checks if the given character is a "complete" korean character. # "Complete" Korean character must have chosung and jungsung, with optional jongsung. # @param [String] ch A string of size 1 def complete_korean_char? ch raise ArgumentError.new('Lengthy input') if str_length(ch) > 1 # Range of Korean chracters in Unicode 2.0: AC00(가) ~ D7A3(힣) ch.unpack('U').all? { | c | c >= 0xAC00 && c <= 0xD7A3 } end private def str_length str str.scan(/./mu).length end end#Korean end#Gimchi
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gimchi-0.1.6 | lib/gimchi/patch_1.8.rb |
gimchi-0.1.5 | lib/gimchi/patch_1.8.rb |
gimchi-0.1.4 | lib/gimchi/patch_1.8.rb |
gimchi-0.1.3 | lib/gimchi/patch_1.8.rb |