summaryrefslogtreecommitdiff
path: root/app/presenters/award_emoji_presenter.rb
blob: 9a1c8d6934d3107c4f0977198ccb3e0828499fe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

class AwardEmojiPresenter < Gitlab::View::Presenter::Delegated
  presents ::AwardEmoji, as: :award_emoji

  def description
    as_emoji&.description
  end

  def unicode
    as_emoji&.hex
  end

  def emoji
    as_emoji&.codepoints
  end

  def unicode_version
    as_emoji&.unicode_version
  end

  private

  def as_emoji
    @emoji ||= TanukiEmoji.find_by_alpha_code(award_emoji.name)
  end
end