Sha256: 55198b000d490a00696942ac8787282c0345d57a56c74429e21d2bb237ce125a

Contents?: true

Size: 729 Bytes

Versions: 5

Compression:

Stored size: 729 Bytes

Contents

module Danger
  class EmojiMapper
    DATA = {
      "github" => {
        "no_entry_sign"    => "🚫",
        "warning"          => "⚠️",
        "book"             => "📖",
        "white_check_mark" => "✅"
      },
      "bitbucket_server" => {
        "no_entry_sign"    => ":no_entry_sign:",
        "warning"          => ":warning:",
        "book"             => ":book:",
        "white_check_mark" => ":white_check_mark:"
      }
    }.freeze

    def initialize(template)
      template.sub!('_inline', '')
      @template = DATA.has_key?(template) ? template : "github"
    end

    def map(emoji)
      emoji.delete! ":"
      DATA[template][emoji]
    end

    private

    attr_reader :template
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
danger-6.3.2 lib/danger/helpers/emoji_mapper.rb
danger-6.3.1 lib/danger/helpers/emoji_mapper.rb
danger-6.3.0 lib/danger/helpers/emoji_mapper.rb
danger-6.2.2 lib/danger/helpers/emoji_mapper.rb
danger-6.2.1 lib/danger/helpers/emoji_mapper.rb