Class: RSpec::Matchers::DelegateMatcher::Dispatcher
- Inherits:
-
Object
- Object
- RSpec::Matchers::DelegateMatcher::Dispatcher
- Defined in:
- lib/delegate_matcher/dispatcher.rb
Instance Attribute Summary collapse
-
#return_value ⇒ Object
readonly
Returns the value of attribute return_value.
Instance Method Summary collapse
- #block ⇒ Object
- #call ⇒ Object
-
#initialize(expected) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
Constructor Details
#initialize(expected) ⇒ Dispatcher
Returns a new instance of Dispatcher.
7 8 9 |
# File 'lib/delegate_matcher/dispatcher.rb', line 7 def initialize(expected) self.expected = expected end |
Instance Attribute Details
#return_value ⇒ Object
Returns the value of attribute return_value.
5 6 7 |
# File 'lib/delegate_matcher/dispatcher.rb', line 5 def return_value @return_value end |
Instance Method Details
#block ⇒ Object
18 19 20 |
# File 'lib/delegate_matcher/dispatcher.rb', line 18 def block @block ||= expected.block.is_a?(Proc) ? expected.block : proc {} end |
#call ⇒ Object
11 12 13 14 15 16 |
# File 'lib/delegate_matcher/dispatcher.rb', line 11 def call args = expected.args args = [] if args && args[0].is_a?(Mocks::ArgumentMatchers::NoArgsMatcher) self.return_value = expected.subject.send(expected.delegator_method_name, *args, &block) end |