Class: Spy::MethodCall
- Inherits:
-
Object
- Object
- Spy::MethodCall
- Defined in:
- lib/spy/method_call.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#backtrace ⇒ Object
(also: #caller)
readonly
Returns the value of attribute backtrace.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#receiver ⇒ Object
readonly
Returns the value of attribute receiver.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#spy ⇒ Object
readonly
Returns the value of attribute spy.
Instance Method Summary collapse
- #call_original(persist_result = false) ⇒ Object (also: #replay)
-
#initialize(spy, receiver, args, block, backtrace) ⇒ MethodCall
constructor
A new instance of MethodCall.
- #name ⇒ Object
Constructor Details
#initialize(spy, receiver, args, block, backtrace) ⇒ MethodCall
Returns a new instance of MethodCall.
5 6 7 8 9 10 11 |
# File 'lib/spy/method_call.rb', line 5 def initialize(spy, receiver, args, block, backtrace) @spy = spy @receiver = receiver @args = args @block = block @backtrace = backtrace end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
3 4 5 |
# File 'lib/spy/method_call.rb', line 3 def args @args end |
#backtrace ⇒ Object (readonly) Also known as: caller
Returns the value of attribute backtrace.
3 4 5 |
# File 'lib/spy/method_call.rb', line 3 def backtrace @backtrace end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
3 4 5 |
# File 'lib/spy/method_call.rb', line 3 def block @block end |
#receiver ⇒ Object (readonly)
Returns the value of attribute receiver.
3 4 5 |
# File 'lib/spy/method_call.rb', line 3 def receiver @receiver end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
3 4 5 |
# File 'lib/spy/method_call.rb', line 3 def result @result end |
#spy ⇒ Object (readonly)
Returns the value of attribute spy.
3 4 5 |
# File 'lib/spy/method_call.rb', line 3 def spy @spy end |
Instance Method Details
#call_original(persist_result = false) ⇒ Object Also known as: replay
17 18 19 20 21 |
# File 'lib/spy/method_call.rb', line 17 def call_original(persist_result = false) result = @spy.call_original(@receiver, @args, @block) @result = result if persist_result result end |
#name ⇒ Object
13 14 15 |
# File 'lib/spy/method_call.rb', line 13 def name @spy.original.name end |