Class: MethodCallCount::CallableStub
- Inherits:
-
Object
- Object
- MethodCallCount::CallableStub
- Defined in:
- lib/method_call_count/callable_stub.rb
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
- #called_with ⇒ Object
-
#initialize(value = nil, &block) ⇒ CallableStub
constructor
A new instance of CallableStub.
Constructor Details
#initialize(value = nil, &block) ⇒ CallableStub
Returns a new instance of CallableStub.
5 6 7 8 |
# File 'lib/method_call_count/callable_stub.rb', line 5 def initialize(value = nil, &block) @block = value.nil? ? block : ->(){value} @called_with = {} end |
Instance Method Details
#call(options = {}) ⇒ Object
9 10 11 12 |
# File 'lib/method_call_count/callable_stub.rb', line 9 def call(={}) @called_with = @block&.call() end |
#called_with ⇒ Object
13 14 15 |
# File 'lib/method_call_count/callable_stub.rb', line 13 def called_with @called_with.dup end |