Sha256: b1c3e382cda568f54154bce608c450d70b8baae45a732757e27ddc9c4790445d
Contents?: true
Size: 619 Bytes
Versions: 2
Compression:
Stored size: 619 Bytes
Contents
# frozen_string_literal: true require_relative 'unicode' module Prawn module Emoji class Text attr_reader :left, :emoji, :remaining def initialize(text) @left, emoji_char, @remaining = partition_by_emoji(text) @emoji = Emoji::Unicode.new(emoji_char) unless emoji_char.empty? end def contains_emoji? !emoji.nil? end def left_with_emoji left + emoji.to_s end def to_s left_with_emoji + remaining end private def partition_by_emoji(text) text.partition(Emoji.regex) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prawn-emoji-3.3.0 | lib/prawn/emoji/text.rb |
prawn-emoji-3.2.0 | lib/prawn/emoji/text.rb |