Class: Ollama::Handlers::DumpJSON
- Inherits:
-
Object
- Object
- Ollama::Handlers::DumpJSON
- Includes:
- Concern
- Defined in:
- lib/ollama/handlers/dump_json.rb
Overview
A handler that outputs JSON representations of responses to the specified output stream.
This class is designed to serialize and display API responses in JSON format, making it easy to inspect the raw data returned by Ollama commands. It implements the standard handler interface and can be used with any command that supports response processing.
Instance Attribute Summary
Attributes included from Concern
Instance Method Summary collapse
-
#call(response) ⇒ self
The call method processes a response by outputting its JSON representation.
Methods included from Concern
Instance Method Details
#call(response) ⇒ self
The call method processes a response by outputting its JSON representation.
This method takes a response object and serializes it into a formatted JSON string, which is then written to the specified output stream. It is designed to provide detailed inspection of API responses in a human-readable format.
24 25 26 27 |
# File 'lib/ollama/handlers/dump_json.rb', line 24 def call(response) @output.puts JSON::pretty_generate(response, allow_nan: true, max_nesting: false) self end |