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.
22 23 24 25 |
# File 'lib/rspec/llm/adapters/fake.rb', line 22 def initialize(parent, matcher) @parent = parent @matcher = matcher end |
Instance Method Details
#with(text = nil, &block) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/rspec/llm/adapters/fake.rb', line 27 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 |