Class: Ollama::Handlers::Markdown
- Inherits:
-
Object
- Object
- Ollama::Handlers::Markdown
- Includes:
- Concern, Term::ANSIColor
- Defined in:
- lib/ollama/handlers/markdown.rb
Instance Attribute Summary
Attributes included from Concern
Instance Method Summary collapse
- #call(response) ⇒ Object
-
#initialize(output: $stdout) ⇒ Markdown
constructor
A new instance of Markdown.
Methods included from Concern
Constructor Details
#initialize(output: $stdout) ⇒ Markdown
Returns a new instance of Markdown.
8 9 10 11 12 |
# File 'lib/ollama/handlers/markdown.rb', line 8 def initialize(output: $stdout) super @output.sync = true @content = '' end |
Instance Method Details
#call(response) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/ollama/handlers/markdown.rb', line 14 def call(response) if content = response.response || response.&.content @content << content markdown_content = Kramdown::ANSI.parse(@content) @output.print clear_screen, move_home, markdown_content end self end |