about summary refs log tree commit diff
path: root/app/lib/emoji.rb
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:18:35 +0200
committerOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:18:35 +0200
commit83bda6c1a813c5aeb131b18a0500fed0c07fa9c2 (patch)
tree32f197901b4b16ea7f94de682fee6cdc44686045 /app/lib/emoji.rb
parentfcf0d2078ea813e0dd318fa154d620018e7b7bcf (diff)
parentb9f59ebcc68e9da0a7158741a1a2ef3564e1321e (diff)
Merge commit 'b9f59ebcc68e9da0a7158741a1a2ef3564e1321e' into merging-upstream
Diffstat (limited to 'app/lib/emoji.rb')
-rw-r--r--app/lib/emoji.rb40
1 files changed, 0 insertions, 40 deletions
diff --git a/app/lib/emoji.rb b/app/lib/emoji.rb
deleted file mode 100644
index 45b7f53de..000000000
--- a/app/lib/emoji.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-
-require 'singleton'
-
-class Emoji
-  include Singleton
-
-  def initialize
-    data = Oj.load(File.open(Rails.root.join('lib', 'assets', 'emoji.json')))
-
-    @map = {}
-
-    data.each do |_, emoji|
-      keys    = [emoji['shortname']] + emoji['aliases']
-      unicode = codepoint_to_unicode(emoji['unicode'])
-
-      keys.each do |key|
-        @map[key] = unicode
-      end
-    end
-  end
-
-  def unicode(shortcode)
-    @map[shortcode]
-  end
-
-  def names
-    @map.keys
-  end
-
-  private
-
-  def codepoint_to_unicode(codepoint)
-    if codepoint.include?('-')
-      codepoint.split('-').map(&:hex).pack('U*')
-    else
-      [codepoint.hex].pack('U')
-    end
-  end
-end