module Twemojify
Constants
- MATCH_REG_EX
- VERSION
Public Class Methods
parse(str, options = {})
click to toggle source
# File lib/twemojify.rb, line 10 def self.parse(str, options = {}) options = Twemojify.options.merge(options) if !str.nil? str.gsub(MATCH_REG_EX) do |match| %Q|<img class="#{options[:class_name]}" draggable="false" alt="#{match}" src="#{options[:base]}#{options[:folder]||options[:size]}/#{get_codepoint(match)}#{options[:ext]}">| end end end
test(str)
click to toggle source
# File lib/twemojify.rb, line 20 def self.test(str) str =~ MATCH_REG_EX end
Private Class Methods
get_codepoint(match)
click to toggle source
# File lib/twemojify.rb, line 26 def self.get_codepoint(match) match.codepoints.map { |a| a.to_s(16) }.join('-') end