Sha256: abd7c1bbf2b87c86c9ad92715f1ed1445ca82729aa2ff2c790e77ca024268d32
Contents?: true
Size: 639 Bytes
Versions: 7
Compression:
Stored size: 639 Bytes
Contents
# frozen_string_literal: true require_relative 'char' module Prawn module Emoji class Text attr_reader :left, :emoji_char, :remaining def initialize(text, font_size) @text = text @left, emoji, @remaining = partition_by_emoji(text) @emoji_char = Emoji::Char.new(emoji, font_size) unless emoji.empty? end def contains_emoji? !emoji_char.nil? end def left_with_emoji left + emoji_char.to_s end def to_s @text end private def partition_by_emoji(text) text.partition(Emoji.regex) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems