module EmojiDatasource

Constants

EMOJI_DATA_PATH
VERSION

Public Class Methods

data() click to toggle source
# File lib/emoji_datasource.rb, line 32
def self.data
  @data ||= JSON.parse(File.read(EMOJI_DATA_PATH), symbolize_names: true)
    .map { |emoji_data| EmojiDatasource::Emoji.new(emoji_data) }
end
find_by_short_name(name) click to toggle source
# File lib/emoji_datasource.rb, line 18
def self.find_by_short_name(name)
  return unless name

  data.detect do |emoji|
    emoji.short_name == name || emoji.short_names.include?(name)
  end
end
short_name_to_char(name) click to toggle source
# File lib/emoji_datasource.rb, line 14
def self.short_name_to_char(name)
  EmojiDatasource::ShortNameToChar.generate(name)
end
unified_to_char(unified_name) click to toggle source
# File lib/emoji_datasource.rb, line 26
def self.unified_to_char(unified_name)
  return unless unified_name

  unified_name.split('-').map(&:hex).pack('U*')
end