Class: RSpec::LLM::Adapters::Fake::Stub
- Inherits:
-
Object
- Object
- RSpec::LLM::Adapters::Fake::Stub
- Defined in:
- lib/rspec/llm/adapters/fake.rb
Overview
Builder returned by #respond_to / #respond_to_pattern so callers can chain ‘.with(text)` or `.with { |prompt| … }`.
Instance Method Summary collapse
-
#initialize(parent, matcher) ⇒ Stub
constructor
A new instance of Stub.
- #with(text = nil, &block) ⇒ Object
Constructor Details
#initialize(parent, matcher) ⇒ Stub
Returns a new instance of Stub.
20 21 22 23 |
# File 'lib/rspec/llm/adapters/fake.rb', line 20 def initialize(parent, matcher) @parent = parent @matcher = matcher end |
Instance Method Details
#with(text = nil, &block) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/rspec/llm/adapters/fake.rb', line 25 def with(text = nil, &block) raise ArgumentError, "pass text or a block" if text.nil? && block.nil? @parent.send(:register, @matcher, text || block) @parent end |