Home

Awesome

emoji-datasource

Ruby gem for emoji-datasource from NPM package https://github.com/iamcal/emoji-data

Installation

Add this line to your application's Gemfile:

gem 'emoji-datasource'

Usage

Return all emoji data

EmojiDatasource.data

Find emoji by short name

EmojiDatasource.find_by_short_name('+1')
#=> EmojiDatasource::Emoji: :+1: (👍)

Find emoji by raw string:

EmojiDatasource.find_by_char('👍🏾')
#=> EmojiDatasource::Emoji: :+1::skin-tone-5: (👍🏾)

Find emoji by unicode hex character code:

EmojiDatasource.find_by_unified("1F469-200D-2764-FE0F-200D-1F468")
#=> EmojiDatasource::Emoji: :woman-heart-man: (👩‍❤️‍👨)

Convert emoji short name to character

EmojiDatasource.short_name_to_char('+1') # => 👍

this also supports skin variations

EmojiDatasource.short_name_to_char('+1::skin-tone-2') # => 👍🏻

Get base emoji for skin variation:

emoji = EmojiDatasource.find_by_short_name(':+1::skin-tone-5:')
#=> EmojiDatasource::Emoji: :+1::skin-tone-5: (👍🏾)
emoji.base
#=> EmojiDatasource::Emoji: :+1: (👍)

Supported Ruby Versions

This library aims to support and is tested against the following Ruby implementations:

License

The gem is available as open source under the terms of the MIT License.