Class: Plugin::CustomEmoji
- Inherits:
-
Object
- Object
- Plugin::CustomEmoji
- Defined in:
- lib/plugin/instance.rb
Class Method Summary collapse
- .cache_key ⇒ Object
- .clear_cache ⇒ Object
- .emojis ⇒ Object
- .register(name, url, group = Emoji::DEFAULT_GROUP) ⇒ Object
- .translate(from, to) ⇒ Object
- .translations ⇒ Object
- .unregister(name, group = Emoji::DEFAULT_GROUP) ⇒ Object
Class Method Details
.cache_key ⇒ Object
10 11 12 |
# File 'lib/plugin/instance.rb', line 10 def self.cache_key @@cache_key ||= CACHE_KEY end |
.clear_cache ⇒ Object
18 19 20 21 22 |
# File 'lib/plugin/instance.rb', line 18 def self.clear_cache @@cache_key = CACHE_KEY @@emojis = {} @@translations = {} end |
.emojis ⇒ Object
14 15 16 |
# File 'lib/plugin/instance.rb', line 14 def self.emojis @@emojis ||= {} end |
.register(name, url, group = Emoji::DEFAULT_GROUP) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/plugin/instance.rb', line 24 def self.register(name, url, group = Emoji::DEFAULT_GROUP) @@cache_key = Digest::SHA1.hexdigest(cache_key + name + group)[0..10] new_group = emojis[group] || {} new_group[name] = url emojis[group] = new_group end |
.translate(from, to) ⇒ Object
39 40 41 42 |
# File 'lib/plugin/instance.rb', line 39 def self.translate(from, to) @@cache_key = Digest::SHA1.hexdigest(cache_key + from)[0..10] translations[from] = to end |
.translations ⇒ Object
35 36 37 |
# File 'lib/plugin/instance.rb', line 35 def self.translations @@translations ||= {} end |
.unregister(name, group = Emoji::DEFAULT_GROUP) ⇒ Object
31 32 33 |
# File 'lib/plugin/instance.rb', line 31 def self.unregister(name, group = Emoji::DEFAULT_GROUP) emojis[group].delete(name) end |