Class: Prawn::Emoji::Image

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/prawn/emoji/image.rb

Constant Summary collapse

STORE =
Emoji.root.join 'emoji', 'images'

Instance Method Summary collapse

Constructor Details

#initialize(emoji_char) ⇒ Image

Returns a new instance of Image.



14
15
16
# File 'lib/prawn/emoji/image.rb', line 14

def initialize(emoji_char)
  @emoji_char = emoji_char
end

Instance Method Details

#pathObject



23
24
25
# File 'lib/prawn/emoji/image.rb', line 23

def path
  STORE.join("#{emoji_char.codepoint}.png").to_s
end

#render(document, at:) ⇒ Object



18
19
20
21
# File 'lib/prawn/emoji/image.rb', line 18

def render(document, at:)
  x, y = at
  document.image(path, at: [x, y + height], width: width)
end