look for aliases in Emoji.lookup_unicode

This commit is contained in:
Joffrey JAFFEUX 2017-06-05 18:53:11 +02:00
parent 09d34b7642
commit 2aae6cfdbe

View File

@ -144,11 +144,20 @@ class Emoji
def self.lookup_unicode(name)
@reverse_map ||= begin
map = {}
db['emojis'].each do |e|
next if e['name'] == 'tm'
code = replacement_code(e['code'])
map[e['name']] = code if code
end
Emoji.aliases.each do |key, alias_names|
next unless alias_code = map[key]
alias_names.each do |alias_name|
map[alias_name] = alias_code
end
end
map
end
@reverse_map[name]