This is a breaking API change.
You probably have code that looks like
if emoji = Emoji.find_by_alias($1) { nil }
that you can change to
if emoji = Emoji.find_by_alias($1)
It's more likely that someone will want to add a new emoji with a custom
image rather than a character that has a Unicode representation.
Also move the VARIATION_SELECTOR_16 logic outside of Emoji::Character
since it doesn't need to be concerned with it.
- Emoji.create(raw) => yields to block
- Emoji.edit_emoji(emoji) => yields to block
The block forms are so that the list of aliases & unicode_aliases is
re-indexed after the update.
Instead of an unfriendly LocalJumpError, raise the Emoji::NotFound
exception with a helpful message if the block was not given.
If a fallback block was given, yield the value for which the lookup failed.
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.
- Cat smilies are equivalent smilies with 'cat' appended.
- Following conventions for arrows, clocks, etc.
- Removing unnecessary modifiers (squared, circled, monkey, etc)
- Adding alias running for runner.
- Removing duplicate hourglass, house, etc.