module Unicode::SequenceName

Constants

DATA_DIRECTORY
EMOJI_VERSION
INDEX
INDEX_FILENAME
IVD_VERSION
UNICODE_VERSION
VERSION

Public Class Methods

of(string)
Alias for: sequence_name
sequence_name(string) click to toggle source
# File lib/unicode/sequence_name.rb, line 5
def self.sequence_name(string)
  codepoints = get_codepoint_values(string)
  require_relative "sequence_name/index" unless defined? ::Unicode::SequenceName::INDEX
  if res = INDEX[codepoints]
    res
  else
    nil
  end
end
Also aliased as: of

Private Class Methods

get_codepoint_values(string) click to toggle source
# File lib/unicode/sequence_name.rb, line 16
def self.get_codepoint_values(string)
  if string.valid_encoding?
    return string.codepoints
  elsif string.encoding.name == "UTF-8"
    begin
      return string.unpack("U*")
    rescue ArgumentError
    end
  end

  raise(ArgumentError, "Unicode::SequenceName.of must be given a valid string")
end