Class: Prawn::Emoji::Unicode
- Inherits:
-
Object
- Object
- Prawn::Emoji::Unicode
- Defined in:
- lib/prawn/emoji/unicode.rb
Constant Summary collapse
- VARIATION_SELECTORS =
{ text: '\ufe0e', emoji: '\ufe0f' }.freeze
Instance Method Summary collapse
- #==(other) ⇒ Object
- #codepoint ⇒ Object
-
#initialize(char) ⇒ Unicode
constructor
A new instance of Unicode.
- #text? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(char) ⇒ Unicode
Returns a new instance of Unicode.
11 12 13 14 |
# File 'lib/prawn/emoji/unicode.rb', line 11 def initialize(char) @present_as_text = !!char.match(VARIATION_SELECTORS[:text]) @unicode = delete_variation_selector(char) end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/prawn/emoji/unicode.rb', line 16 def ==(other) to_s == other.to_s end |
#codepoint ⇒ Object
20 21 22 |
# File 'lib/prawn/emoji/unicode.rb', line 20 def codepoint @codepoint ||= @unicode.codepoints.map { |c| '%04x' % c.to_s }.join('-').downcase end |
#text? ⇒ Boolean
24 25 26 |
# File 'lib/prawn/emoji/unicode.rb', line 24 def text? @present_as_text end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/prawn/emoji/unicode.rb', line 28 def to_s @unicode end |