Class: Insika::Evals::EvalProfile::OverlayRegistry
- Inherits:
-
Object
- Object
- Insika::Evals::EvalProfile::OverlayRegistry
- Defined in:
- lib/insika/evals/simulator.rb
Overview
The overlay behind EvalProfile.registry. Kept as a named class so the
constant is assigned once at load time, not inside the method.
Instance Method Summary collapse
- #entries ⇒ Object
-
#initialize(base:, swapped:, fake:) ⇒ OverlayRegistry
constructor
A new instance of OverlayRegistry.
- #names ⇒ Object
- #resolve(name) ⇒ Object
- #side_effect?(name) ⇒ Boolean
Constructor Details
#initialize(base:, swapped:, fake:) ⇒ OverlayRegistry
Returns a new instance of OverlayRegistry.
187 188 189 190 191 |
# File 'lib/insika/evals/simulator.rb', line 187 def initialize(base:, swapped:, fake:) @base = base @swapped = swapped @fake = fake end |
Instance Method Details
#entries ⇒ Object
194 |
# File 'lib/insika/evals/simulator.rb', line 194 def entries = @base.entries |
#names ⇒ Object
193 |
# File 'lib/insika/evals/simulator.rb', line 193 def names = @base.names |
#resolve(name) ⇒ Object
197 198 199 200 201 202 |
# File 'lib/insika/evals/simulator.rb', line 197 def resolve(name) key = name.to_s return @fake.call(key) if @swapped.include?(key) @base.resolve(key) end |
#side_effect?(name) ⇒ Boolean
195 |
# File 'lib/insika/evals/simulator.rb', line 195 def side_effect?(name) = @swapped.include?(name.to_s) ? false : @base.side_effect?(name) |