Class: Ollama::Handlers::Single

Inherits:
Object
  • Object
show all
Includes:
Concern
Defined in:
lib/ollama/handlers/single.rb

Instance Attribute Summary

Attributes included from Concern

#output

Instance Method Summary collapse

Methods included from Concern

#to_proc

Constructor Details

#initialize(output: $stdout) ⇒ Single

Returns a new instance of Single.



4
5
6
7
# File 'lib/ollama/handlers/single.rb', line 4

def initialize(output: $stdout)
  super
  @array = []
end

Instance Method Details

#call(response) ⇒ Object



9
10
11
12
# File 'lib/ollama/handlers/single.rb', line 9

def call(response)
  @array << response
  self
end

#resultObject



14
15
16
# File 'lib/ollama/handlers/single.rb', line 14

def result
  @array.size <= 1 ? @array.first : @array
end