Class: Slk::Formatters::JsonMessageFormatter
- Inherits:
-
Object
- Object
- Slk::Formatters::JsonMessageFormatter
- Defined in:
- lib/slk/formatters/json_message_formatter.rb
Overview
Formats Slack messages as JSON for structured output
Instance Method Summary collapse
-
#format(message, workspace: nil, options: {}) ⇒ Object
Format a message as a JSON-serializable hash.
-
#initialize(cache_store:) ⇒ JsonMessageFormatter
constructor
A new instance of JsonMessageFormatter.
Constructor Details
#initialize(cache_store:) ⇒ JsonMessageFormatter
Returns a new instance of JsonMessageFormatter.
7 8 9 |
# File 'lib/slk/formatters/json_message_formatter.rb', line 7 def initialize(cache_store:) @cache = cache_store end |
Instance Method Details
#format(message, workspace: nil, options: {}) ⇒ Object
Format a message as a JSON-serializable hash
12 13 14 15 16 17 18 19 20 |
# File 'lib/slk/formatters/json_message_formatter.rb', line 12 def format(, workspace: nil, options: {}) result = build_base_result() result[:reactions] = format_reactions(.reactions, workspace, ) add_user_name(result, , workspace, ) add_channel_info(result, workspace, ) result end |