Permalink
Browse files

Get emoji list & aliases from data file instead of symlinks

Previously, emoji name & unicode aliases were determined by following
symlinks among `images/emoji/*.png`. This led to nontrivial code for
resolving these aliases, made it tricky for contributors to add new
aliases and inspect existing ones, and didn't leave room for adding
metadata to emojis such as tags or descriptions from the Unicode spec.

Moreover, the aliases as symlinks led to duplication of image assets in
users' applications, with `hocho.png` and `knife.png` representing the
same emoji but being two separate images. Users were also unsure what to
do with `unicode/{HEX-NAME}.png` files, which would end up among their
images after running the `:emoji` task.

This change removes the symlinks support and creates the list of emojis
and their aliases in `emoji.json`. A single emoji is now represented with
an Emoji::Character instance, which has the `image_filename` method to
determine the path to the corresponding image instead of having to
construct it manually.
  • Loading branch information...
1 parent c8c9805 commit 2fad57ed49625d2af15b46e90aa0c833366ea7a7 @mislav mislav committed Mar 13, 2014
Showing with 8,458 additions and 54 deletions.
  1. +0 −2 README.md
  2. +8,247 −0 db/emoji.json
  3. +7 −1 gemoji.gemspec
  4. +61 −33 lib/emoji.rb
  5. +75 −0 lib/emoji/character.rb
  6. +56 −6 test/emoji_test.rb
  7. +12 −12 test/integrity_test.rb
View
@@ -78,5 +78,3 @@ Translate emoji names to unicode and vice versa.
>> Emoji.name_for("\u{1f431}")
=> "cat"
```
-
-Note: These will only work if you install gemoji from github. In your Gemfile, for example: `gem 'gemoji', github: 'github/gemoji'`.
Oops, something went wrong.

0 comments on commit 2fad57e

Please sign in to comment.