lib/unidecoder.rb in talentbox-unidecoder-1.1.2 vs lib/unidecoder.rb in talentbox-unidecoder-2.0.0
- old
+ new
@@ -58,21 +58,12 @@
def in_yaml_file(character)
unpacked = character.unpack("U")[0]
"#{code_group(unpacked)}.yml (line #{grouped_point(unpacked) + 2})"
end
- def define_normalize(library = nil, &block)
- return if method_defined? :normalize
- begin
- require library if library
- define_method(:normalize, &block)
- rescue LoadError
- end
+ def normalize(str)
+ str.unicode_normalize(:nfc)
end
-
- define_normalize("unicode") {|str| Unicode.normalize_C(str)}
- define_normalize("active_support") {|str| ActiveSupport::Multibyte::Chars.new(str).normalize(:c).to_s}
- define_normalize {|str| str}
def decode_char(char)
unpacked = char.unpack("U")[0]
CODEPOINTS[code_group(unpacked)][grouped_point(unpacked)]
end