Module: LLM::Utils
Overview
Shared utility methods used across the runtime.
Instance Method Summary collapse
-
#resolve_option(obj, option, resolve_symbol: true) ⇒ Object
Resolves a configured option against an object instance.
Instance Method Details
#resolve_option(obj, option, resolve_symbol: true) ⇒ Object
Resolves a configured option against an object instance.
Proc values are evaluated with ‘instance_exec`, symbol values are optionally sent to the object as method calls, hashes are duplicated, and all other values are returned as-is.
20 21 22 23 24 25 26 27 |
# File 'lib/llm/utils.rb', line 20 def resolve_option(obj, option, resolve_symbol: true) case option when Proc then obj.instance_exec(&option) when Symbol then resolve_symbol ? obj.send(option) : option when Hash then option.dup else option end end |