Sha256: b004a1b38464aadf07a77a226d6dd2b028d89d320c717aeb37dbe7cf735e2e30
Contents?: true
Size: 790 Bytes
Versions: 5
Compression:
Stored size: 790 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Utils module CodePoints class << self def to_char(code_point) [code_point.upcase.hex].pack('U*') end def from_char(char) char.unpack('U*').first.to_s(16).upcase.rjust(4, '0') end def from_chars(chars) chars.map { |char| from_char(char) } end def to_chars(code_points) code_points.map { |code_point| to_char(code_point) } end def from_string(str) from_chars(str.chars.to_a) end def to_string(code_points) code_points.map{ |code_point| to_char(code_point) }.join end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems