Class: Ollama::Params::Base
- Inherits:
-
Object
- Object
- Ollama::Params::Base
show all
- Defined in:
- lib/ollama/params.rb
Overview
Base parameter class with common behavior
Instance Method Summary
collapse
Instance Method Details
#merge(other) ⇒ Object
16
17
18
19
|
# File 'lib/ollama/params.rb', line 16
def merge(other)
other.to_h.each { |k, v| send("#{k}=", v) if respond_to?("#{k}=") && !v.nil? }
self
end
|
#to_h ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/ollama/params.rb', line 8
def to_h
instance_variables.each_with_object({}) do |var, hash|
key = var.to_s.delete("@").to_sym
value = instance_variable_get(var)
hash[key] = value unless value.nil?
end
end
|