Class: Slk::Formatters::TextProcessor
- Inherits:
-
Object
- Object
- Slk::Formatters::TextProcessor
- Defined in:
- lib/slk/formatters/text_processor.rb
Overview
Centralized text processing for message display Handles HTML entity decoding, mention replacement, and emoji replacement
Instance Method Summary collapse
-
#initialize(mention_replacer:, emoji_replacer:) ⇒ TextProcessor
constructor
A new instance of TextProcessor.
-
#process(text, workspace, options = {}) ⇒ String
Process raw Slack message text for display.
Constructor Details
#initialize(mention_replacer:, emoji_replacer:) ⇒ TextProcessor
Returns a new instance of TextProcessor.
8 9 10 11 |
# File 'lib/slk/formatters/text_processor.rb', line 8 def initialize(mention_replacer:, emoji_replacer:) @mentions = mention_replacer @emoji = emoji_replacer end |
Instance Method Details
#process(text, workspace, options = {}) ⇒ String
Process raw Slack message text for display
20 21 22 23 24 25 26 27 |
# File 'lib/slk/formatters/text_processor.rb', line 20 def process(text, workspace, = {}) return '[No text]' if text.to_s.empty? result = decode_html_entities(text.dup) result = safe_replace_mentions(result, workspace) unless [:no_mentions] result = safe_replace_emoji(result, workspace) unless [:no_emoji] result end |