Class: RailsAiBridge::Tools::GetView::FullFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- RailsAiBridge::Tools::GetView::FullFormatter
- Defined in:
- lib/rails_ai_bridge/tools/get_view/full_formatter.rb
Overview
Formats full view details including templates, partials, helpers, and components.
Instance Method Summary collapse
-
#call ⇒ String
The formatted full output.
Methods inherited from BaseFormatter
Constructor Details
This class inherits a constructor from RailsAiBridge::Tools::GetView::BaseFormatter
Instance Method Details
#call ⇒ String
Returns The formatted full output.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rails_ai_bridge/tools/get_view/full_formatter.rb', line 9 def call filtered = filter_view_data return "View introspection failed: #{filtered[:error]}" if filtered[:error] lines = [StandardFormatter.new(context: @context, controller: @controller, partial: @partial).call] if filtered[:helpers].any? lines << '' << '## Helpers' filtered[:helpers].each do |helper| methods = Array(helper[:methods]).join(', ') lines << "- `#{helper[:file]}`: #{methods}" end end if filtered[:view_components].any? lines << '' << '## View Components' filtered[:view_components].each { |component| lines << "- `#{component}`" } end lines.join("\n") end |