Class: Caricature::Messenger
Overview
A base class to encapsulate method invocation
Direct Known Subclasses
Instance Attribute Summary collapse
-
#expectations ⇒ Object
readonly
the expecations that have been set for the isolation.
-
#instance ⇒ Object
readonly
the real instance of the isolated subject used to forward calls in partial mocks.
-
#recorder ⇒ Object
contains the recorder for recording method calls.
Instance Method Summary collapse
-
#deliver(method_name, return_type, *args, &b) ⇒ Object
deliver the message to the receiving isolation.
-
#deliver_to_class(method_name, return_type, *args, &b) ⇒ Object
deliver the message to class of the receiving isolation.
-
#initialize(expectations, instance = nil) ⇒ Messenger
constructor
creates a new instance of this messaging strategy.
Constructor Details
#initialize(expectations, instance = nil) ⇒ Messenger
creates a new instance of this messaging strategy
17 18 19 |
# File 'lib/caricature/messenger.rb', line 17 def initialize(expectations, instance=nil) @instance, @expectations = instance, expectations end |
Instance Attribute Details
#expectations ⇒ Object (readonly)
the expecations that have been set for the isolation
14 15 16 |
# File 'lib/caricature/messenger.rb', line 14 def expectations @expectations end |
#instance ⇒ Object (readonly)
the real instance of the isolated subject used to forward calls in partial mocks
11 12 13 |
# File 'lib/caricature/messenger.rb', line 11 def instance @instance end |
#recorder ⇒ Object
contains the recorder for recording method calls
7 8 9 |
# File 'lib/caricature/messenger.rb', line 7 def recorder @recorder end |
Instance Method Details
#deliver(method_name, return_type, *args, &b) ⇒ Object
deliver the message to the receiving isolation
22 23 24 25 |
# File 'lib/caricature/messenger.rb', line 22 def deliver(method_name, return_type, *args, &b) internal_deliver(:instance, method_name, return_type, *args, &b) end |
#deliver_to_class(method_name, return_type, *args, &b) ⇒ Object
deliver the message to class of the receiving isolation
28 29 30 |
# File 'lib/caricature/messenger.rb', line 28 def deliver_to_class(method_name, return_type, *args, &b) internal_deliver(:class, method_name, return_type, *args, &b) end |