class SlackTransformer::Entities

Attributes

input[R]

Public Class Methods

new(input) click to toggle source
# File lib/slack_transformer/entities.rb, line 5
def initialize(input)
  @input = input
end

Public Instance Methods

to_slack() click to toggle source

See api.slack.com/docs/message-formatting#how_to_escape_characters NB: The order matters here. If you were to replace < with &lt; first, for

example, you'd end up with &amp;lt;
# File lib/slack_transformer/entities.rb, line 12
def to_slack
  input.gsub('&', '&amp;')
       .gsub('<', '&lt;')
       .gsub('>', '&gt;')
end