Emoji images and names.
Перейти к файлу
Joshua Peek e11d502d4d Gemoji 1.1.1 2012-10-02 17:06:00 -05:00
images/emoji Move images into subdir 2012-10-02 16:20:53 -05:00
lib Fix rake task path 2012-10-02 17:05:39 -05:00
LICENSE try to give attribution where possible 2012-10-02 15:24:13 -05:00
README.md Update bundler instructions 2012-10-02 16:30:57 -05:00
gemoji.gemspec Gemoji 1.1.1 2012-10-02 17:06:00 -05:00

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