2015-11-26 14:37:03 +05:30
|
|
|
class AwardEmoji
|
2016-01-14 18:37:52 +05:30
|
|
|
CATEGORIES = {
|
|
|
|
other: "Other",
|
|
|
|
objects: "Objects",
|
|
|
|
places: "Places",
|
|
|
|
travel_places: "Travel",
|
|
|
|
emoticons: "Emoticons",
|
|
|
|
objects_symbols: "Symbols",
|
|
|
|
nature: "Nature",
|
|
|
|
celebration: "Celebration",
|
|
|
|
people: "People",
|
|
|
|
activity: "Activity",
|
|
|
|
flags: "Flags",
|
|
|
|
food_drink: "Food"
|
2015-12-23 02:04:40 +05:30
|
|
|
}.with_indifferent_access
|
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
def self.normilize_emoji_name(name)
|
|
|
|
aliases[name] || name
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|
2015-12-23 02:04:40 +05:30
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
def self.emoji_by_category
|
|
|
|
unless @emoji_by_category
|
|
|
|
@emoji_by_category = {}
|
|
|
|
|
|
|
|
emojis.each do |emoji_name, data|
|
|
|
|
data["name"] = emoji_name
|
|
|
|
|
|
|
|
@emoji_by_category[data["category"]] ||= []
|
|
|
|
@emoji_by_category[data["category"]] << data
|
|
|
|
end
|
|
|
|
|
|
|
|
@emoji_by_category = @emoji_by_category.sort.to_h
|
|
|
|
end
|
|
|
|
|
|
|
|
@emoji_by_category
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.emojis
|
|
|
|
@emojis ||= begin
|
|
|
|
json_path = File.join(Rails.root, 'fixtures', 'emojis', 'index.json' )
|
|
|
|
JSON.parse(File.read(json_path))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.aliases
|
|
|
|
@aliases ||= begin
|
|
|
|
json_path = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json' )
|
|
|
|
JSON.parse(File.read(json_path))
|
|
|
|
end
|
2015-12-23 02:04:40 +05:30
|
|
|
end
|
2015-11-26 14:37:03 +05:30
|
|
|
end
|