-
Rename a number of methods to be clearer and more consistent with that they actually do:
EmojiChar.char()→EmojiChar.render()EmojiData.find_by_unified()→EmojiData.from_unified()EmojiData.find_by_str()→EmojiData.scan()
Don't worry, the old names are still aliased in so you don't have to change anything in your existing code. This change is make things clearer for people new to the library.
-
Add new
.from_short_name()library method for fast keyword lookups. -
DEVELOPERS: Internal code cleanup and better comments.
-
DEVELOPERS: Add benchmark suite for comparing method implementation time across versions of this library.
- Add support for Unicode variant encodings, used by MacOSX 10.9 / iOS 7.
- For more info: http://www.unicode.org/L2/L2011/11438-emoji-var.pdf
- By default,
EmojiChar.to_s()and.char()will now use the variant encoding.
- With adding support for variants, the speed of
find_by_strregressed by approximately 20% (because there are more codepoints to match against). To counter this, we switched to a Regex based scan than improves performance of the method by over 250x(!). A complete sorted search against 1000 strings now takes ~2ms where before it would take around a half second. - Import latest version of iamcal/emoji-data.
- 100% test coverage. 😎
-
On initialization, create hashmaps to cache lookups for
.find_by_unified().In a quick benchmark in MRI 2.1.1, this reduces the time needed for one million lookups from
13.5sto0.3s!This is only for lookup by unified ID for now, since the other
find_by_*()methods are actually searches that can return multiple values. I'll look at nested hashmaps for those if there is a pressing performance need later.
- Remove JSON gem dependency since no longer supporting Ruby 1.8.7 anyhow.
- Add
EmojiData.find_by_strconvenience method to match on a string. - Make default
EmojiChar.to_s()the same asEmojiChar.char()
- Initial release