Class: RubyCode::Client::DisplayFormatter
- Inherits:
-
Object
- Object
- RubyCode::Client::DisplayFormatter
- Defined in:
- lib/rubycode/client/display_formatter.rb
Overview
Handles formatting and display of tool information and results
Constant Summary collapse
- TOOL_LABELS =
{ "bash" => ["[BASH]", "command"], "read" => ["[READ]", "file_path"], "search" => ["[SEARCH]", "pattern"], "write" => ["[WRITE]", "file_path"], "update" => ["[UPDATE]", "file_path"], "web_search" => ["[WEB SEARCH]", "query"], "fetch" => ["[FETCH]", "url"] }.freeze
Instance Method Summary collapse
- #display_info(message) ⇒ Object
- #display_result(result, tool_name: nil) ⇒ Object
- #display_skip_notification(_tool_name, detail) ⇒ Object
- #display_tool_info(tool_name, arguments) ⇒ Object
-
#initialize(config:) ⇒ DisplayFormatter
constructor
A new instance of DisplayFormatter.
Constructor Details
#initialize(config:) ⇒ DisplayFormatter
Returns a new instance of DisplayFormatter.
20 21 22 23 |
# File 'lib/rubycode/client/display_formatter.rb', line 20 def initialize(config:) @config = config @pastel = Pastel.new end |
Instance Method Details
#display_info(message) ⇒ Object
34 35 36 |
# File 'lib/rubycode/client/display_formatter.rb', line 34 def display_info() puts Views::Formatter::InfoMessage.build(message: ) end |
#display_result(result, tool_name: nil) ⇒ Object
29 30 31 32 |
# File 'lib/rubycode/client/display_formatter.rb', line 29 def display_result(result, tool_name: nil) # Show summaries for web tools display_tool_summary(result, tool_name) if %w[web_search fetch].include?(tool_name) end |
#display_skip_notification(_tool_name, detail) ⇒ Object
38 39 40 |
# File 'lib/rubycode/client/display_formatter.rb', line 38 def display_skip_notification(_tool_name, detail) puts @pastel.yellow(" ⓘ Skipped: #{detail}") end |
#display_tool_info(tool_name, arguments) ⇒ Object
25 26 27 |
# File 'lib/rubycode/client/display_formatter.rb', line 25 def display_tool_info(tool_name, arguments) display_minimal_tool_info(tool_name, arguments) end |