Sha256: 5072a9ac74f35173fd25240185221ec305e3360eaecdb15d2729c0eebe13b66a
Contents?: true
Size: 718 Bytes
Versions: 20
Compression:
Stored size: 718 Bytes
Contents
# encoding: utf-8 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 |match| sign = $~[:sign] dt = $~[:dt] rhs = dt.split('|', 2).last case sign when '@', '!' "@#{rhs}" when '#' "##{rhs}" else rhs end end) end end end end end
Version data entries
20 entries across 20 versions & 2 rubygems