Class: OllamaChat::Switches::CombinedSwitch
- Inherits:
-
Object
- Object
- OllamaChat::Switches::CombinedSwitch
- Includes:
- CheckSwitch
- Defined in:
- lib/ollama_chat/switches.rb
Overview
Manages a boolean state based on a dynamic proc evaluation.
The CombinedSwitch class is useful for complex conditions that depend on multiple factors or dynamic values, such as combining multiple switch states into a single effective state.
Instance Method Summary collapse
-
#initialize(value:, msg:) ⇒ CombinedSwitch
constructor
Initializes a new CombinedSwitch instance.
-
#value ⇒ Boolean
Returns the result of calling the stored proc.
Methods included from CheckSwitch
Constructor Details
#initialize(value:, msg:) ⇒ CombinedSwitch
Initializes a new CombinedSwitch instance.
257 258 259 260 261 262 263 |
# File 'lib/ollama_chat/switches.rb', line 257 def initialize(value:, msg:) if arity = value.ask_and_send(:arity) arity <= 0 or raise TypeError, 'value Proc requires arity <= 0' end @value = value @msg = msg end |
Instance Method Details
#value ⇒ Boolean
Returns the result of calling the stored proc.
268 269 270 |
# File 'lib/ollama_chat/switches.rb', line 268 def value @value.() end |