Class: SlackTransformer::Entities
- Inherits:
-
Object
- Object
- SlackTransformer::Entities
- Defined in:
- lib/slack_transformer/entities.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
-
#initialize(input) ⇒ Entities
constructor
A new instance of Entities.
-
#to_slack ⇒ Object
See api.slack.com/docs/message-formatting#how_to_escape_characters NB: The order matters here.
Constructor Details
#initialize(input) ⇒ Entities
Returns a new instance of Entities.
5 6 7 |
# File 'lib/slack_transformer/entities.rb', line 5 def initialize(input) @input = input end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
3 4 5 |
# File 'lib/slack_transformer/entities.rb', line 3 def input @input end |
Instance Method Details
#to_slack ⇒ Object
See api.slack.com/docs/message-formatting#how_to_escape_characters NB: The order matters here. If you were to replace < with < first, for
example, you'd end up with &lt;
12 13 14 15 16 |
# File 'lib/slack_transformer/entities.rb', line 12 def to_slack input.gsub('&', '&') .gsub('<', '<') .gsub('>', '>') end |