Module: RailsAiContext::Serializers::ContextModeDispatch

Included in:
ClaudeSerializer, CopilotSerializer, OpencodeSerializer
Defined in:
lib/rails_ai_context/serializers/context_mode_dispatch.rb

Overview

Shared shape for the per-tool serializers that render a compact file by default and hand off to a full-mode serializer when configured.

Including classes supply #render_compact and #full_serializer_class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



10
11
12
# File 'lib/rails_ai_context/serializers/context_mode_dispatch.rb', line 10

def context
  @context
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
# File 'lib/rails_ai_context/serializers/context_mode_dispatch.rb', line 16

def call
  if RailsAiContext.configuration.context_mode == :full
    full_serializer_class.new(context).call
  else
    render_compact
  end
end

#initialize(context) ⇒ Object



12
13
14
# File 'lib/rails_ai_context/serializers/context_mode_dispatch.rb', line 12

def initialize(context)
  @context = context
end