lib/danger/helpers/emoji_mapper.rb in danger-6.3.2 vs lib/danger/helpers/emoji_mapper.rb in danger-7.0.0
- old
+ new
@@ -13,17 +13,26 @@
"book" => ":book:",
"white_check_mark" => ":white_check_mark:"
}
}.freeze
+ TYPE_TO_EMOJI = {
+ error: "no_entry_sign",
+ warning: "warning",
+ message: "book",
+ }.freeze
+
def initialize(template)
- template.sub!('_inline', '')
@template = DATA.has_key?(template) ? template : "github"
end
def map(emoji)
- emoji.delete! ":"
+ emoji&.delete! ":"
DATA[template][emoji]
+ end
+
+ def from_type(type)
+ map(TYPE_TO_EMOJI[type])
end
private
attr_reader :template