Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Emoji images and names.

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 images
Octocat-spinner-32 lib
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 gemoji.gemspec
README.md

gemoji

Emoji images and names. See the LICENSE for copyright information.

Installation

Add gemoji to you Gemfile.

gem 'gemoji', :require => 'emoji/railtie'

Example Rails Helper

This would allow emojifying content such as: it's raining :cats: and :dogs:!

See the Emoji cheat sheet for more examples.

module EmojiHelper
 def emojify(content)
    h(content).to_str.gsub(/:([a-z0-9\+\-_]+):/) do |match|
      if Emoji.names.include?($1)
        '<img alt="' + $1 + '" height="20" src="' + asset_path("emoji/#{$1}.png") + '" style="vertical-align:middle" width="20" />'
      else
        match
      end
    end.html_safe if content.present?
  end
end
Something went wrong with that request. Please try again.