Class: Prawn::Emoji::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/emoji/text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, font_size) ⇒ Text

Returns a new instance of Text.


10
11
12
13
14
# File 'lib/prawn/emoji/text.rb', line 10

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

Instance Attribute Details

#emoji_charObject (readonly)

Returns the value of attribute emoji_char


8
9
10
# File 'lib/prawn/emoji/text.rb', line 8

def emoji_char
  @emoji_char
end

#leftObject (readonly)

Returns the value of attribute left


8
9
10
# File 'lib/prawn/emoji/text.rb', line 8

def left
  @left
end

#remainingObject (readonly)

Returns the value of attribute remaining


8
9
10
# File 'lib/prawn/emoji/text.rb', line 8

def remaining
  @remaining
end

Instance Method Details

#contains_emoji?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'lib/prawn/emoji/text.rb', line 16

def contains_emoji?
  !emoji_char.nil?
end

#left_with_emojiObject


20
21
22
# File 'lib/prawn/emoji/text.rb', line 20

def left_with_emoji
  left + emoji_char.to_s
end

#to_sObject


24
25
26
# File 'lib/prawn/emoji/text.rb', line 24

def to_s
  @text
end