Sha256: 5b06a4c481f75858a7c41832d7bb6e44e844bfd0b2384601294ba6384231d9ce
Contents?: true
Size: 752 Bytes
Versions: 10
Compression:
Stored size: 752 Bytes
Contents
# frozen_string_literal: true module Slack module Messages module Formatting class << self # # Unescape a message. # @see https://api.slack.com/docs/formatting # def unescape(message) CGI.unescapeHTML(message.gsub(/[“”]/, '"') .gsub(/[‘’]/, "'") .gsub(/<(?<sign>[?@#!]?)(?<dt>.*?)>/) do sign = Regexp.last_match[:sign] dt = Regexp.last_match[:dt] rhs = dt.split('|', 2).last case sign when '@', '!' "@#{rhs}" when '#' "##{rhs}" else rhs end end) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems