Sha256: 9898135cb6abf0c6d16a89eda81ff45d8ce67d2820dc6ff077a2d9be087adcdc
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
require 'rumoji' require 'emoji' module Emojionearea module Rails module Helper def gemojify(content) text_symbol = Rumoji.encode(content) text_symbol.gsub(/:([\w+-]+):/) do |match| if emoji = Emoji.find_by_alias($1) image_tag("png_64/#{emoji.image_filename.split("/").last}", size:'16x16', style:"vertical-align:middle") else match end end.html_safe if content.present? end def gemojify_cdn(content) text_symbol = Rumoji.encode(content) text_symbol.gsub(/:([\w+-]+):/) do |match| if emoji = Emoji.find_by_alias($1) %(<img alt="#{emoji.raw}" src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.1.4/assets/png/#{emoji.image_filename.split("/").last}" style="vertical-align:middle" width="16" height="16" />) else match end end.html_safe if content.present? end def gemojify_wp(content) text_symbol = Rumoji.encode(content) text_symbol.gsub(/:([\w+-]+):/) do |match| if emoji = Emoji.find_by_alias($1) %(<img alt="#{emoji.raw}" src="http://emojione.com/wp-content/uploads/assets/emojis/#{emoji.image_filename.split("/").last.split(".").first}.svg" style="vertical-align:middle" width="16" height="16" />) else match end end.html_safe if content.present? end def emojify_code(content) text_symbol = Rumoji.encode(content) {|emoji| emoji.code } if content.present? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
emojionearea-rails-1.1.3 | lib/emojionearea/rails/helper.rb |