Class: Collavre::SystemEvents::ContextBuilder
- Inherits:
-
Object
- Object
- Collavre::SystemEvents::ContextBuilder
- Defined in:
- app/services/collavre/system_events/context_builder.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(context) ⇒ ContextBuilder
constructor
A new instance of ContextBuilder.
Constructor Details
#initialize(context) ⇒ ContextBuilder
Returns a new instance of ContextBuilder.
4 5 6 |
# File 'app/services/collavre/system_events/context_builder.rb', line 4 def initialize(context) @context = context end |
Instance Method Details
#build ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/collavre/system_events/context_builder.rb', line 8 def build # Ensure context is a hash with string keys for Liquid ctx = @context.deep_stringify_keys # Add helper objects/functions if ctx["chat"] ctx["chat"]["mentioned_user"] ||= mentioned_user(ctx["chat"]) end # Add sender context for A2A communication ctx["sender"] ||= build_sender_context(ctx) ctx end |