gemoji

This library contains character information about native emoji, as well as image files for a few custom emoji.

Installation

Add gemoji to your Gemfile.

gem 'gemoji'

Extract images

To obtain image files as fallbacks for browsers and OS's that don't support emoji, run the gemoji extract command on macOS Sierra or later:

bundle exec gemoji extract public/images/emoji

This will extract images into filenames such as:

  • public/images/emoji/octocat.png
  • public/images/emoji/unicode/1f9c0.png (the :cheese: emoji)

Example Rails Helper

This would allow emojifying content such as: it's raining :cat:s and :dog:s!

See the Emoji cheat sheet for more examples.

module EmojiHelper
  def emojify(content)
    h(content).to_str.gsub(/:([\w+-]+):/) do |match|
      if emoji = Emoji.find_by_alias($1)
        %(<img alt="#$1" src="#{image_path("emoji/#{emoji.image_filename}")}" style="vertical-align:middle" width="20" height="20" />)
      else
        match
      end
    end.html_safe if content.present?
  end
end

Unicode mapping

Translate emoji names to unicode and vice versa.


>> Emoji.find_by_alias("cat").raw
=> "

Related Repositories

emoji-cheat-sheet.com

emoji-cheat-sheet.com

A one pager for emojis on Campfire and GitHub ...

webogram

webogram

Telegram web application, GPL v3 ...

ruby-bookmarks

ruby-bookmarks

Ruby and Ruby on Rails bookmarks collection ...

ruby-nlp

ruby-nlp

A collection of links to Ruby Natural Language Processing (NLP) libraries, tools ...

ZWEmoji

ZWEmoji

Objective-C library for using unicode emoji based on emoji codes used in Campfir ...


Top Contributors

josh trevorturk mislav javan juliamae asianmack danthompson aroben jeremy bkeepers jeffmcneill cobyism rick shayfrendt lautis gavingmiller elektronaut janko-m VxJasonxV wearhere marconilanna spraints skalnik phoet robrix rsenk330 tricknotes tnm TheRakken

Releases

-   v2.1.0 zip tar
-   v2.0.1 zip tar
-   v2.0.0 zip tar
-   v1.5.0 zip tar
-   v1.4.0 zip tar
-   v1.3.1 zip tar
-   v1.3.0 zip tar
-   v1.2.1 zip tar
-   v1.2.0 zip tar
-   v1.1.3 zip tar
-   v1.1.2 zip tar
-   v1.1.1 zip tar
-   v1.1.0 zip tar
-   v1.0.0 zip tar
-   v0.4.0 zip tar
-   v0.3.4 zip tar
-   v0.3.3 zip tar
-   v0.3.2 zip tar
-   v0.3.1 zip tar
-   v0.3.0 zip tar