Sha256: 40b72bfa8f03197e3f3ee1fe08ef5c74a2130e1a96e12518fb877e8c0924ee27
Contents?: true
Size: 722 Bytes
Versions: 8
Compression:
Stored size: 722 Bytes
Contents
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
8 entries across 8 versions & 1 rubygems