Sha256: 74f12db3db9b4583086503b2ed146024c8e6acbfe8e9dc954138800998bed1f7

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require 'hamster'

module TwitterCldr
  module Normalization
    class Base

      class << self

        def normalize(string)
          code_points = TwitterCldr::Utils::CodePoints.from_string(string)
          normalized_code_points = normalize_code_points(code_points)
          TwitterCldr::Utils::CodePoints.to_string(normalized_code_points)
        end

        def combining_class_for(code_point)
          combining_class_cache[code_point] ||=
            TwitterCldr::Shared::CodePoint.find(code_point).combining_class.to_i
        rescue NoMethodError
          0
        end

        protected

        def combining_class_cache
          @combining_class_cache ||= {}
        end

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-3.0.0.beta1 lib/twitter_cldr/normalization/base.rb