Class: RailsAiBridge::Serializers::MarkdownSerializer
- Inherits:
-
Object
- Object
- RailsAiBridge::Serializers::MarkdownSerializer
- Defined in:
- lib/rails_ai_bridge/serializers/markdown_serializer.rb
Overview
Builds a full markdown document from introspection data. Each section is delegated to a dedicated formatter under Formatters. Header and footer can be swapped via constructor injection to produce AI-assistant-specific variants (Claude, Copilot, Codex).
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#call ⇒ String
Full markdown document.
-
#initialize(context, header_class: Formatters::Providers::HeaderFormatter, footer_class: Formatters::Providers::FooterFormatter) ⇒ MarkdownSerializer
constructor
A new instance of MarkdownSerializer.
Constructor Details
#initialize(context, header_class: Formatters::Providers::HeaderFormatter, footer_class: Formatters::Providers::FooterFormatter) ⇒ MarkdownSerializer
Returns a new instance of MarkdownSerializer.
15 16 17 18 19 |
# File 'lib/rails_ai_bridge/serializers/markdown_serializer.rb', line 15 def initialize(context, header_class: Formatters::Providers::HeaderFormatter, footer_class: Formatters::Providers::FooterFormatter) @context = context @header_class = header_class @footer_class = end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
10 11 12 |
# File 'lib/rails_ai_bridge/serializers/markdown_serializer.rb', line 10 def context @context end |
Instance Method Details
#call ⇒ String
Returns full markdown document.
22 23 24 |
# File 'lib/rails_ai_bridge/serializers/markdown_serializer.rb', line 22 def call section_classes.map { |klass| klass.new(context).call }.compact.join("\n\n") end |