lib/prawn/emoji/index.rb in prawn-emoji-2.0.1 vs lib/prawn/emoji/index.rb in prawn-emoji-2.1.0

- old
+ new

@@ -1,7 +1,9 @@ # frozen_string_literal: true +require_relative 'unicode' + module Prawn module Emoji class Index EXCLUSION_CHARS = '1234567890#*'.freeze @@ -16,10 +18,13 @@ end private def build_regexp - Regexp.new(codepoints.map { |codepoint| unicode(codepoint) }.join('|')) + emojis = codepoints.map { |codepoint| unicode(codepoint) } + variation_selectors = Emoji::Unicode::VARIATION_SELECTORS.values + + Regexp.new("(#{emojis.join('|')})[#{variation_selectors.join}]?") end def load_emoji_codepoints codepoints = YAML.load_file(Emoji.root.join('emoji', 'index.yml')) codepoints.reject { |codepoint| /#{unicode(codepoint)}/ =~ EXCLUSION_CHARS }